-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (55 loc) · 1.39 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// `CheckerPlugin` is optional. Use it if you want async error reporting.
// We need this plugin to detect a `--watch` mode. It may be removed later
// after https://github.com/webpack/webpack/issues/3460 will be resolved.
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
app: ['./src/common/tweaks.js', './src/app/app.jsx'],
},
output: {
path: path.resolve(__dirname, 'dist/public'),
filename: '[name].bundle.js'
},
// Currently we need to add '.ts' to the resolve.extensions array.
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
// Source maps support ('inline-source-map' also works)
devtool: 'inline-source-map',
// Add the loader for .ts files.
module: {
rules: [
{
test:/\.(s*)css$/,
use:['style-loader','css-loader', 'sass-loader']
},
{
test: /\.html?$/,
loader: "file-loader?name=[name].[ext]"
},
{
test: /\.m?jsx?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
"@babel/preset-react",
],
}
}
}
]
},
plugins: [
new CopyPlugin([
{
from: './src/app/**/*.html',
to: "./",
flatten: true
}
])
]
};