This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.base.config.js
71 lines (66 loc) · 1.66 KB
/
webpack.base.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
61
62
63
64
65
66
67
68
69
70
71
// External dependencies
var autoprefixer = require( 'autoprefixer' ),
path = require( 'path' ),
webpack = require( 'webpack' ),
supportedLocales = require( './app/config/languages' ).map( function( language ) { return language.langSlug; } );
var config = {
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: [ 'babel' ],
include: [
path.resolve( __dirname, 'client' ),
path.resolve( __dirname, 'app' ),
path.resolve( __dirname, 'lib' ),
path.resolve( __dirname, 'server' )
]
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.scss$/,
loaders: [
'isomorphic-style',
'css?modules&importLoaders=1&localIdentName=[path][local]&camelCase=dashes&sourceMap',
'postcss',
'sass?sourceMap'
]
},
{
test: /\.svg$/,
loader: 'babel!svg-react'
}
]
},
resolve: {
extensions: [ '.json', '.js', '.jsx' ],
enforceExtension: false,
modules: [
'node_modules',
path.join( path.resolve( path.dirname( '' ) ), 'app' ),
path.resolve( path.dirname( '' ) )
]
},
// Enables source maps both for the client and server.
devtool: 'source-map',
plugins: [
new webpack.LoaderOptionsPlugin( {
test: /\.scss$/,
debug: ! process.env.NODE_ENV || process.env.NODE_ENV === 'development',
options: {
sassLoader: {
data: "$env: " + process.env.NODE_ENV + ";",
includePaths: [ path.resolve( __dirname, 'app' ) ]
},
context: __dirname,
postcss: () => [ autoprefixer ]
}
} ),
// Exclude unused locales from moment.js
new webpack.ContextReplacementPlugin( /moment[\/\\]locale$/, new RegExp( supportedLocales.join('|') ) )
]
};
module.exports = config;