-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
32 lines (30 loc) · 1.21 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require('path');
const config = {
entry: {
vendor: ['@babel/polyfill', 'react'], // Third party libraries
index: ['./src/components/clientSideEntryPoint/Index.jsx'],
/// Every pages entry point should be mentioned here
},
output: {
path: path.resolve(__dirname, 'public', 'dist'), //destination for bundled output is under ./src/public
filename: '[name].js', // names of the bundled file will be name of the entry files (mentioned above)
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader', // asks bundler to use babel loader to transpile es2015 code
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
exclude: [/node_modules/, /public/],
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.wasm', '.mjs', '*'],
}, // If multiple files share the same name but have different extensions, webpack will resolve the one with the extension listed first in the array and skip the rest.
};
module.exports = config;