-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
72 lines (70 loc) · 2.07 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
60
61
62
63
64
65
66
67
68
69
70
71
72
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = {
mode: 'development',
entry: {
bundle: path.resolve(__dirname, 'src/index.js'),
},
resolve: {
alias: {
components: path.resolve(__dirname, 'src/components/'),
consts: path.resolve(__dirname, 'src/consts/'),
controllers: path.resolve(__dirname, 'src/controllers'),
services: path.resolve(__dirname, 'src/services/'),
utils: path.resolve(__dirname, 'src/utils/'),
views: path.resolve(__dirname, 'src/views/'),
'index.scss': path.resolve(__dirname, 'public/css/index.scss'),
},
extensions: ['.js',],
fallback: {
'crypto': require.resolve('crypto-browserify'),
'stream': require.resolve('stream-browserify'),
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
},
{
test: /\.s[ac]ss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.hbs$/,
use: 'handlebars-loader',
},
{
// IMAGE LOADER
test: /\.(jpe?g|png|gif|svg)$/i,
loader:'file-loader'
},
{
// HTML LOADER
test: /\.html$/,
loader: 'html-loader'
},
],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
publicPath:'/static/',
},
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
template: path.resolve(__dirname, 'public/index.html'),
filename: 'index.html',
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser.js',
}),
],
experiments: {
asyncWebAssembly: true,
}
};