This repository was archived by the owner on Feb 19, 2025. It is now read-only.
forked from algolia/jekyll-algolia
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
63 lines (62 loc) · 1.51 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
const webpack = require('webpack');
const path = require('path');
const config = require('./config.js');
const HappyPack = require('happypack');
module.exports = {
entry: {
'js/main': path.join(__dirname, 'src/assets/js/main.js'),
},
output: {
path: config.docsDist,
publicPath: config.publicPath,
filename: '[name].js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'happypack/loader?id=babel',
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: 'happypack/loader?id=style',
},
],
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'js/common',
minChunks: module =>
/\/react\//.test(module.context) ||
/\/react-dom\//.test(module.context) ||
/\/lodash\//.test(module.context) ||
/\/fbjs\//.test(module.context) ||
/\/algolia-frontend-components\//.test(module.context),
}),
new HappyPack({
loaders: [
{
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env'], '@babel/preset-react'],
},
},
],
id: 'babel',
}),
new HappyPack({
loaders: [
'style-loader?insertAt=top',
'css-loader',
'postcss-loader',
'sass-loader',
],
id: 'style',
}),
],
};