diff --git a/src/cli/index.ts b/src/cli/index.ts index b9d046bad..5a3892643 100755 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,10 +1,11 @@ import { build, export as exporter } from 'sapper/core.js'; -import { dest, dev, entry, src } from '../config'; +import { dest, entry, isDev, src } from '../config'; process.env.NODE_ENV = 'production'; const cmd = process.argv[2]; const start = Date.now(); +const dev = isDev(); if (cmd === 'build') { build({ dest, dev, entry, src }) diff --git a/src/config.ts b/src/config.ts index f685ca762..310f7f054 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -export const dev = process.env.NODE_ENV !== 'production'; +export const isDev = () => process.env.NODE_ENV !== 'production'; export const templates = path.resolve(process.env.SAPPER_TEMPLATES || 'templates'); export const src = path.resolve(process.env.SAPPER_ROUTES || 'routes'); @@ -9,4 +9,4 @@ export const dest = path.resolve(process.env.SAPPER_DEST || '.sapper'); export const entry = { client: path.resolve(templates, '.main.rendered.js'), server: path.resolve(dest, 'server-entry.js') -}; \ No newline at end of file +}; diff --git a/src/middleware/index.ts b/src/middleware/index.ts index dfb690058..6e91718b6 100644 --- a/src/middleware/index.ts +++ b/src/middleware/index.ts @@ -5,8 +5,10 @@ import rimraf from 'rimraf'; import serialize from 'serialize-javascript'; import escape_html from 'escape-html'; import { create_routes, templates, create_compilers, create_assets } from 'sapper/core.js'; +import { dest, entry, isDev, src } from '../config'; import create_watcher from './create_watcher'; -import { dest, dev, entry, src } from '../config'; + +const dev = isDev(); function connect_dev() { mkdirp.sync(dest); diff --git a/src/webpack/index.ts b/src/webpack/index.ts index 4cf620ece..c7f398fe1 100644 --- a/src/webpack/index.ts +++ b/src/webpack/index.ts @@ -1,7 +1,7 @@ -import { dest, dev, entry } from '../config'; +import { dest, isDev, entry } from '../config'; export default { - dev, + dev: isDev(), client: { entry: () => {