-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
54 lines (40 loc) · 1.24 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
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
app: [
'./source/javascripts/app.js',
'./source/stylesheets/app.scss'
]
},
output: {
path: './.tmp/dist',
filename: 'javascripts/[name].js'
},
module: {
loaders: [
// JS
{ test: /source\/javascripts\/.*\.js$/, exclude: /(node_modules|\.tmp|build)/, loader: 'babel-loader', query: {presets: ['es2015', 'react']}},
// SCSS
{ test: /\.scss$/, loader: ExtractTextPlugin.extract("style", "css!sass")},
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader?minimize") },
// FONTS
{ test: /\.(eot|svg|ttf|woff|woff2|otf)$/, loader: 'file?name=[name].[ext]'}
],
},
resolve: {
extensions: ['', '.js', '.json', '.jsx']
},
plugins: [
// CSS output file
new ExtractTextPlugin("stylesheets/app.css", {allChunks: true}),
// Make React globally available
new webpack.ProvidePlugin({
React: "react",
ReactDOM: "react-dom"
}),
// Remove/clean build folder before building
// new CleanWebpackPlugin('build')
],
};