-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
54 lines (53 loc) · 1.78 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); //installed via npm
const Dotenv = require('dotenv-webpack');
const webpack = require('webpack'); //to access built-in plugins
module.exports = {
entry: ["@babel/polyfill",path.resolve(__dirname, './src/index.js')],
output: {
path: path.resolve(__dirname, './build'),
filename: 'app.js'
},
mode:'development',
devtool: 'inline-source-map',
devServer: {
before(app) {
// ========================================================
// use proper headers for SharedArrayBuffer on Firefox
// see https://github.com/ffmpegwasm/ffmpeg.wasm/issues/102
// ========================================================
app.use((req, res, next) => {
res.header('Cross-Origin-Opener-Policy', 'same-origin');
res.header('Cross-Origin-Embedder-Policy', 'require-corp');
next();
});
},
contentBase: path.join(__dirname, './build'),
compress: true,
port: 3000,
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif|eot|svg|ttf|woff|mov|mp4)$/i,
loader: 'file-loader',
options: {
outputPath: 'images',
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(s[ac]ss|css)$/i,
use: ['style-loader', 'css-loader', 'sass-loader']
}
]
},
plugins: [
new HtmlWebpackPlugin({template: path.resolve(__dirname + '/src/index.html')}),
new Dotenv(),
]
}