Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Fix: Remove HMR attempts in Prod~! #114

Merged
merged 1 commit into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -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 })
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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')
};
};
4 changes: 3 additions & 1 deletion src/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dest, dev, entry } from '../config';
import { dest, isDev, entry } from '../config';

export default {
dev,
dev: isDev(),

client: {
entry: () => {
Expand Down