-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (44 loc) · 1.62 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
const { resolve } = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = () => {
const config = {
mode: 'development',
entry: './src/index',
output: {
filename: 'bundle.js',
path: resolve(__dirname, 'build'),
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_module/, loader: 'babel-loader' },
{ test: /\.scss$/, exclude: /node_module/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.(png|jpg|gif|svg)$/, use: [{ loader: 'url-loader', options: { limit: 8192 } }] },
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.API_URL': JSON.stringify(process.env.API_URL || 'http://localhost:9001/graphql'),
}),
],
resolve: {
alias: {
_Styles: resolve(__dirname, 'src/_Styles'),
Actions: resolve(__dirname, 'src/Actions'),
Components: resolve(__dirname, 'src/Components'),
config: resolve(__dirname, 'config.js'),
Store: resolve(__dirname, 'src/Store'),
src: resolve(__dirname, 'src'),
},
},
devServer: {
historyApiFallback: true,
},
devtool: 'eval-source-map',
};
return config;
};