-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
42 lines (34 loc) · 1020 Bytes
/
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
require('./node_modules/coffee-script/register')
const branch = process.env.TRAVIS_BRANCH
if (branch === 'master') process.env.ENV = 'PROD'
if (branch === 'dev') process.env.ENV = 'DEV'
if (branch === 'qa') process.env.ENV = 'QA'
const webpackConfig = require('appirio-tech-webpack-config')
const config = webpackConfig({
dirname: __dirname,
template: './tc-ui-app/index.html',
entry: {
app: ['./tc-ui-app/index']
}
})
// Adding react hot loader
const babelOptions = {
presets: [ 'es2015', 'react', 'stage-2' ],
plugins: [ 'lodash' ]
}
const jsxLoader = {
test: /\.(js|jsx)$/,
loaders: [
'react-hot',
'babel?' + JSON.stringify(babelOptions)
],
exclude: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/
}
// Loop over loaders and replace
config.module.loaders.forEach((loader, i, loaders) => {
if (loader.loader === 'babel' && String(loader.test) === String(/\.(js|jsx)$/)) {
jsxLoader.include = loader.include
loaders[i] = jsxLoader
}
})
module.exports = config