-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
108 lines (105 loc) · 2.8 KB
/
webpack.config.babel.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict'
import path from 'path'
import webpack from 'webpack'
import BrowserSyncPlugin from 'browser-sync-webpack-plugin'
const publicPath = path.resolve(__dirname, './src/client')
const buildPath = path.resolve(__dirname, './src')
process.noDeprecation = true
module.exports = {
devtool: '#source-maps',
performance: {
hints: false
},
context: publicPath,
entry: {
bundle: [
'script-loader!jquery/dist/jquery.min.js',
'script-loader!tether/dist/js/tether.min.js',
'script-loader!bootstrap/dist/js/bootstrap.min.js',
'./app.js'
]
},
output: {
path: path.join(buildPath, 'dist'),
filename: '[name].js',
publicPath: '/dist/'
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
apiCall: path.resolve(__dirname, 'src/client/api/apiCall.jsx'),
DisplayComponent: path.resolve(__dirname, 'src/client/scenes/home/components/DisplayComponent.jsx'),
SearchComponent: path.resolve(__dirname, 'src/client/scenes/home/components/SearchComponent.jsx'),
Home: path.resolve(__dirname, 'src/client/scenes/home/index.jsx'),
Navigation: path.resolve(__dirname, 'src/client/scenes/shared/navigation/index.jsx'),
Container: path.resolve(__dirname, 'src/client/scenes/Container.js')
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules|dist/,
loader: 'babel-loader',
options: {
plugins: [
[
'babel-plugin-react-css-modules',
{
context: publicPath,
filetypes: {
'.scss': 'postcss-scss'
}
}
]
]
}
},
{
test: /\.local\.(css|scss)$/,
use: [
'style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
'postcss-loader',
'sass-loader',
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, './src/client/styles/global/sass-resources.scss')
}
}
]
},
{
test: /^((?!\.local).)+\.(css|scss)$/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader'
]
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
jquery: 'jquery'
}),
new BrowserSyncPlugin({
host: 'localhost',
port: 3002,
files: ['./dist/*.ejs'],
proxy: 'http://localhost:3000',
open: false,
tunnel: 'proba',
browser: ['chrome', 'firefox']
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
})
]
}