Skip to content

Commit

Permalink
Enable production optimizations when compiling in production (#2234)
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose authored and gauravtiwari committed Sep 18, 2019
1 parent d577bab commit 5ec508c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/install/loaders/elm.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
const { resolve } = require('path')

const isProduction = process.env.NODE_ENV === 'production'
const isDevelopment = process.env.NODE_ENV === 'development'
const elmSource = resolve(process.cwd())
const elmBinary = `${elmSource}/node_modules/.bin/elm`

const elmDefaultOptions = { cwd: elmSource, pathToElm: elmBinary }
const developmentOptions = Object.assign({}, elmDefaultOptions, {
verbose: true,
debug: true
})
const options = {
cwd: elmSource,
pathToElm: elmBinary,
optimize: isProduction,
verbose: isDevelopment,
debug: isDevelopment
}

const elmWebpackLoader = {
loader: 'elm-webpack-loader',
options: isProduction ? elmDefaultOptions : developmentOptions
options: options
}

module.exports = {
Expand Down

0 comments on commit 5ec508c

Please sign in to comment.