-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (60 loc) · 1.66 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
const path = require('path');
const Visualizer = require('webpack-visualizer-plugin');
const { BS_PORT, PT_PROJECT_TOKEN } = require('./src/config');
const PacktrackerPlugin = require('@packtracker/webpack-plugin');
module.exports = {
entry: {
'babel-polyfill': ['@babel/polyfill'],
index: ['./src/front/index.js'],
},
output: {
path: path.join(__dirname, 'public', 'javascript'),
filename: '[name].min.js',
},
resolve: {
extensions: ['.js'],
alias: {
'@pages': path.resolve(__dirname, 'src/front/pages/'),
'@components': path.resolve(__dirname, 'src/front/components/'),
'@utils': path.resolve(__dirname, 'src/utils/'),
'@contexts': path.resolve(__dirname, 'src/front/contexts/'),
'@fixtures': path.resolve(__dirname, 'src/fixtures/'),
'@services': path.resolve(__dirname, 'src/server/services/'),
'@routes': path.resolve(__dirname, 'src/server/routes/'),
'@root': path.resolve(__dirname, 'src/'),
},
},
devtool: 'source-map',
devServer: {
proxy: {
'/': {
target: `http://localhost:${BS_PORT}`,
secure: false,
},
},
},
module: {
// noParse: /(node_modules|\.(test.js|spec.js|test.js.snap)$)/,
rules: [
{
test: /\.(js)?$/,
// exclude: /(node_modules|\.(test.js|spec.js|test.js.snap)$)/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
],
},
plugins: [
new Visualizer(),
new PacktrackerPlugin({
project_token: PT_PROJECT_TOKEN,
upload: process.env.CI === 'true',
}),
],
};