webpack loaders and include

前端 未结 3 1497
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 22:02

I\'m new to webpack and I\'m trying to understand loaders as well as its properties such as test, loader, include etc.

Here is a sample snippet of webpack.config.js that

3条回答
  •  情话喂你
    2021-02-06 22:37

    1) Correct.

    2) Correct.

    3) Correct.

    4) I am unsure. My webpack.config.js file includes an output key, and does bundle it all into one file:

    output: {
        path: path.resolve(__dirname, 'build'),
        filename: 'bundle.js'
    }
    

    5) Correct.

    6) This tells babel-loader what sort of transpile you want it to perform, as well as other compile options. So, for example, if you want it to transpile jsx as well + cache results for improve performance, you would change it to:

    query: {
        presets: ['react', 'es2015'],
        cacheDirectory: true
    }
    

提交回复
热议问题