UNPKG

1.34 kBJavaScriptView Raw
1require('./node_modules/coffee-script/register')
2
3const branch = process.env.TRAVIS_BRANCH
4
5if (branch === 'master') process.env.ENV = 'PROD'
6if (branch === 'dev') process.env.ENV = 'DEV'
7if (branch === 'qa') process.env.ENV = 'QA'
8
9const config = require('appirio-tech-webpack-config')({
10 dirname: __dirname,
11 entry: {
12 app: ['./src/index']
13 },
14 template: './src/index.html',
15 browserUrl: 'http://localhost:3000/search/members?q=java'
16})
17
18// Set asset prefix to CDN
19// FIXME: Move to constants in webpack-config
20if (branch === 'dev') config.output.publicPath = '//d2w5g0u9h79yyx.cloudfront.net/'
21if (branch === 'qa') config.output.publicPath = '//changeme.cloudfront.net/'
22if (branch === 'master') config.output.publicPath = '//changeme.cloudfront.net/'
23
24// Adding react hot loader
25const babelOptions = {
26 presets: [ 'es2015', 'react', 'stage-2' ],
27 plugins: [ 'lodash' ]
28}
29
30const jsxLoader = {
31 test: /\.(js|jsx)$/,
32 loaders: [
33 'react-hot',
34 'babel?' + JSON.stringify(babelOptions)
35 ],
36 exclude: /node_modules\/(?!appirio-tech.*)/
37}
38
39// Loop over loaders and replace
40config.module.loaders.forEach((loader, i, loaders) => {
41 if (loader.loader === 'babel' && String(loader.test) === String(/\.(js|jsx)$/)) {
42 jsxLoader.include = loader.include
43 loaders[i] = jsxLoader
44 }
45})
46
47module.exports = config