-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.universal.js
71 lines (66 loc) · 1.54 KB
/
webpack.universal.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
/* eslint-disable */
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const modulevalues = require('postcss-modules-values')
const cssnext = require('postcss-cssnext')
const nested = require('postcss-nested')
const atImport = require('postcss-import')
/* eslint-enable */
const PATHS = {
src: path.join(__dirname, 'src'),
app: path.join(__dirname, 'src', 'client', 'app.js'),
dist: path.join(__dirname, 'dist', 'js'),
}
const webpackconfig = {
devtool: 'eval-cheap-module-source-map',
entry: {
app: [
PATHS.app,
],
},
output: {
path: PATHS.dist,
filename: 'bundle.js', // Output name of bundle
publicPath: '/',
},
module: {
loaders: [
{
test: /\.js$/, // Javascript loader
include: PATHS.src,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
presets: ['es2015', 'react'],
},
},
{
test: /\.css/,
exclude: /node_modules/,
loaders: [
'style',
'css?modules&sourceMap&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]',
'postcss',
],
},
],
},
postcss: () => ([
atImport,
nested,
cssnext,
modulevalues,
]),
plugins: [
],
}
const complier = webpack(webpackconfig)
/* eslint-disable */
complier.run((err, stats) => {
console.log(err)
console.log(stats)
})
/* eslint-enable */