-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
67 lines (64 loc) · 1.57 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
import webpack from 'webpack';
import path from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
import CopyPlugin from 'copy-webpack-plugin';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
mode: 'none',
output: {
path: path.resolve(__dirname, 'dist', 'public'),
filename: '[name].js',
publicPath: '/static/',
},
devtool: 'eval',
resolve: {
extensions: ['.cjs', '.js', '.styl'],
fallback: {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
},
},
entry: {
bundle: './client/app.cjs',
login: './client/login.js',
},
module: {
rules: [
{
test: /\.[m]?js/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.styl$/,
use: [
{ loader: 'file-loader', options: { name: '[name].css' } },
{ loader: 'stylus-loader' },
],
},
{
test: /\.mp3$/,
use: [{ loader: 'file-loader', options: { name: '[name].mp3' } }],
},
],
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
stylus: {
use: [require('nib')()],
import: ['~nib/lib/nib/index.styl'],
},
},
}),
new CopyPlugin({
patterns: [
{ from: 'public', to: path.resolve(__dirname, 'dist', 'public') },
{ from: 'app/digital/template.html', to: './template.html' },
],
}),
],
};