This repository was archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
77 lines (74 loc) · 1.95 KB
/
webpack.config.js
File metadata and controls
77 lines (74 loc) · 1.95 KB
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
72
73
74
75
76
77
/* global process, __dirname */
const offlineVersion = process.env.OFFLINE_VERSION;
const WORDMARK = process.env.SITE_WORDMARK_PATH;
const NODE_ENV = process.env.NODE_ENV;
const USE_POLYFILLS = Boolean( process.env.USE_POLYFILLS );
const OFFLINE_STRATEGY = process.env.OFFLINE_STRATEGY || 'none';
const API_PATH = process.env.API_PATH || '/api/';
var webpack = require( 'webpack' );
var ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
// There are two possibly entry points. One with polyfills and one without.
var mainEntryPoint = USE_POLYFILLS ? './libs/client/app-shimmed.js' : './libs/client/app.js';
module.exports = {
entry: {
main: mainEntryPoint,
sw: './libs/workers/service-worker.js',
push: './libs/workers/web-push.js'
},
output: {
path: __dirname + '/public/',
filename: '[name]-bundle.js',
publicPath: '/'
},
plugins: [
new ExtractTextPlugin( { filename: 'style.css', allChunks: true } ),
new webpack.DefinePlugin( {
'process.env': {
OFFLINE_STRATEGY: `"${OFFLINE_STRATEGY}"`,
API_PATH: `"${API_PATH}"`,
NODE_ENV: `"${NODE_ENV}"`
},
'global.__VERSION__': JSON.stringify( {
number: offlineVersion,
wordmark: WORDMARK
} )
} )
],
resolve: {
extensions: [ 'index.js', '.js', '.jsx' ]
},
module: {
loaders: [
{
test: /\.jsx$/,
loader: 'babel-loader',
query: {
presets: [ 'es2015', 'react' ]
},
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: [ 'es2015' ]
},
exclude: /node_modules/
},
{
test: /\.(svg)$/,
loader: 'svg-url-loader'
},
{
test: /\.(gif|png|jpg)$/,
loader: 'url-loader',
query: {
limit: '25000'
}
},
{ test: /\.css$/, loader: ExtractTextPlugin.extract( { fallback: 'style-loader', use: [ 'css-loader' ] } ) },
{ test: /\.less$/, loader: ExtractTextPlugin.extract( { fallback: 'style-loader',
use: [ 'css-loader', 'less-loader' ] } ) }
]
}
};