Skip to content

Commit

Permalink
Update webpack to the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Dec 13, 2018
1 parent f223ed0 commit 9290f41
Show file tree
Hide file tree
Showing 15 changed files with 4,421 additions and 425 deletions.
33 changes: 15 additions & 18 deletions config/webpack.js
@@ -1,42 +1,41 @@
var path = require('path')
const path = require('path')

var config = {
cache: true,
devtool: process.env.NODE_ENV === 'production' ? 'source-map' : 'inline-source-map',
const isProduction = process.env.NODE_ENV === 'production'

const config = {
mode: isProduction ? 'production' : 'development',
devtool: isProduction ? 'source-map' : 'inline-source-map',
entry: getEntryConfig(),
output: getOutputConfig(),
module: {
loaders: [
{test: /\.js$/, exclude: /node_modules/, loaders: ['babel']},
{test: /\.json$/, loader: 'json'}
]
rules: [{ test: /\.js$/, exclude: /node_modules/, use: 'babel-loader' }]
}
}

function getEntryConfig () {
module.exports = config

function getEntryConfig() {
if (process.env.BUILD_TESTS) {
return {
'tests': './testWithoutLocales.js'
tests: './testWithoutLocales.js'
}
} else if (process.env.NODE_ENV === 'test') {
return {}
return undefined
} else {
return {
'date_fns': './tmp/umd/index.js'
date_fns: './tmp/umd/index.js'
}
}
}

function getOutputConfig () {
function getOutputConfig() {
if (process.env.BUILD_TESTS) {
return {
path: path.join(process.cwd(), 'tmp'),
filename: '[name].js'
}
} else if (process.env.NODE_ENV === 'test') {
return {
path: '/'
}
return undefined
} else {
return {
path: path.join(process.cwd(), 'dist'),
Expand All @@ -46,5 +45,3 @@ function getOutputConfig () {
}
}
}

module.exports = config
1 change: 1 addition & 0 deletions examples/babel/package.json
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"dependencies": {
"babel-core": "^6.22.1",
"babel-loader": "6",
"babel-plugin-date-fns": "^0.1.0",
"babel-preset-babili": "^0.0.11",
"babel-preset-es2015": "^6.22.0",
Expand Down

0 comments on commit 9290f41

Please sign in to comment.