-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.main.js
74 lines (73 loc) · 2.1 KB
/
webpack.main.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
/*eslint-disable*/
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname,
entry: ['./src/index.js', './css/application.css'],
output: {
path: path.resolve(__dirname, "dist"),
publicPath: '/',
filename: "application.js"
},
resolve: {
root: [
path.join(__dirname, 'src'),
path.join(__dirname, 'css'),
path.join(__dirname, 'images'),
],
extensions: ['', '.js', '.css', '.svg'],
},
root: [
path.join(__dirname, 'src'),
path.join(__dirname, 'test')
],
module: {
loaders: [
{
test: /\.json$/,
loader: "json-loader"
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel?presets[]=react,presets[]=es2015,plugins[]=transform-class-properties'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader'
},
{
test: /.*\.(gif|png|jpe?g|svg)$/i,
loader: 'file?hash=sha512&digest=hex&name=[hash].[ext]'
}
],
},
postcss: function(webpack) {
return [
require('postcss-import')({ // Import all the css files...
glob: true,
addDependencyTo: webpack // ...so they get hot–reloaded when something changes...
}),
require('postcss-nested')(),
require('postcss-simple-vars')(), // ...then replace the variables...
require('postcss-focus')(), // ...add a :focus to ever :hover...
require('autoprefixer')({ // ...and add vendor prefixes...
browsers: ['last 2 versions', 'IE > 8'] // ...supporting the last 2 major browser versions and IE 8 and up...
}),
require('postcss-reporter')({ // This plugin makes sure we get warnings in the console
clearMessages: true
})
];
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new HtmlWebpackPlugin({
template: 'index.ejs', // Move the index.html file
title: 'Checklist | Dev',
appMountId: 'app-container'
})
]
};