forked from triestpa/Atlas-Of-Thrones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (40 loc) · 1.22 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
const path = require('path')
const BabiliPlugin = require('babili-webpack-plugin')
// Babel loader for Transpiling ES8 Javascript for browser usage
const babelLoader = {
test: /\.js$/,
loader: 'babel-loader',
include: [path.resolve(__dirname, '../app')],
query: { presets: ['es2017'] }
}
// SCSS loader for transpiling SCSS files to CSS
const scssLoader = {
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}
// URL loader to resolve data-urls at build time
const urlLoader = {
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}
// HTML load to allow us to import HTML templates into our JS files
const htmlLoader = {
test: /\.html$/,
loader: 'html-loader'
}
const webpackConfig = {
entry: './app/main.js', // Start at app/main.js
output: {
path: path.resolve(__dirname, 'public'),
filename: 'bundle.js' // Output to public/bundle.js
},
module: { loaders: [ babelLoader, scssLoader, urlLoader, htmlLoader ] }
}
if (process.env.NODE_ENV === 'production') {
// Minify for production build
webpackConfig.plugins = [ new BabiliPlugin({}) ]
} else {
// Generate sourcemaps for dev build
webpackConfig.devtool = 'eval-source-map'
}
module.exports = webpackConfig