forked from invinst/watts-new-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
60 lines (56 loc) · 1.9 KB
/
webpack.production.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
const path = require('path');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const buildPath = path.resolve(__dirname, 'public', 'build');
const mainPath = path.resolve(__dirname, 'app', 'js', 'main.js');
const cssMainPath = path.resolve(__dirname, 'app', 'scss', 'main.scss');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractSass = new ExtractTextPlugin({
filename: '[name].bundle.css',
disable: process.env.NODE_ENV === 'development'
});
const config = {
// We change to normal source mapping
devtool: 'source-map',
entry: [mainPath, cssMainPath],
output: {
path: buildPath,
filename: '[name].bundle.js'
},
resolve: {
alias: {
'TweenLite': path.resolve('node_modules', 'gsap/src/uncompressed/TweenLite.js'),
'TweenMax': path.resolve('node_modules', 'gsap/src/uncompressed/TweenMax.js'),
'TimelineLite': path.resolve('node_modules', 'gsap/src/uncompressed/TimelineLite.js'),
'TimelineMax': path.resolve('node_modules', 'gsap/src/uncompressed/TimelineMax.js'),
'ScrollMagic': path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/ScrollMagic.js'),
'animation.gsap': path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js'),
'debug.addIndicators': path.resolve('node_modules', 'scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js')
},
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: [nodeModulesPath]
}, {
test: /\.scss$/,
use: extractSass.extract({
use: [{
loader: 'css-loader'
}, {
loader: 'sass-loader'
}]
})
}, {
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}, {
test: /\.gif$/,
loader: 'file-loader'
}]
},
plugins: [
extractSass
]
};
module.exports = config;