forked from mozilla/copyright
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (50 loc) · 1.45 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
require('habitat').load();
var webpack = require('webpack');
var Path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var AssetsPlugin = require('assets-webpack-plugin');
module.exports = {
entry: ['./dist/client.js','./less/index.less'],
output: {
filename: '[name].[hash].js',
chunkFilename: '[id].chunk.js',
path: Path.join('public')
},
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [
{ test: /\.json$/, loaders: ['json-loader'], exclude: ['node_modules'] },
{ test: /\.less$/, loader: ExtractTextPlugin.extract(
'css?sourceMap!less?sourceMap'
), exclude: ['node_modules'] }
],
preLoaders: [
{ test: /\.jsx$/, loaders: ['eslint-loader'], exclude: ['node_modules'] }
]
},
eslint: {
emitError: true,
emitWarning: true
},
plugins: [
new AssetsPlugin({
path: Path.join(__dirname, "public")
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify({
APPLICATION_URI: process.env.APPLICATION_URI,
OPTIMIZELY_ID: process.env.OPTIMIZELY_ID,
OPTIMIZELY_ACTIVE: process.env.OPTIMIZELY_ACTIVE,
FULL_SUBDOMAIN_FOR_COOKIE: process.env.FULL_SUBDOMAIN_FOR_COOKIE
})
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new ExtractTextPlugin("style.[hash].css", {
allChunks: true
})
]
};