This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
43 lines (42 loc) · 1.75 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
33
34
35
36
37
38
39
40
41
42
43
const path = require('path');
module.exports = (_, argv) => [{
/** Main entry point. https://webpack.js.org/concepts/entry-points */
entry: './frontend/src/main.js',
/** Top-level output. https://webpack.js.org/configuration/output */
output: {
path: path.join(__dirname, 'frontend', 'public', 'dist'),
filename: '[name].js' // https://webpack.js.org/configuration/output/#outputfilename
},
/** Different types of modules within the project. https://webpack.js.org/configuration/module */
module: {
rules: [
/**
* Transpile react JSX to JS. https://webpack.js.org/loaders/babel-loader
* React, webpack, and Babel 7: https://www.valentinog.com/blog/babel/
*/
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: { 'presets': ['@babel/preset-env', '@babel/preset-react'] }
}
}
]
},
/** Generate source map in development mode. https://webpack.js.org/configuration/devtool */
devtool: argv.mode === 'development' ? 'source-map' : false,
}, {
/** Standalone modules for browser support. */
entry: {
/** Provides polyfills necessary for a full ES2015+ environment. https://github.com/babel/babel/tree/master/packages/babel-polyfill */
polyfills: 'babel-polyfill',
/** The Fetch standard defines requests, responses, and the process that binds them: fetching. https://github.com/whatwg/fetch */
fetch: 'whatwg-fetch'
},
devtool: false,
output: {
path: path.join(__dirname, 'frontend', 'public', 'dist'),
filename: 'support.[name].js'
}
}];