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

Commit

Permalink
Merge pull request #114 from lukeed/fix/prod-hmr
Browse files Browse the repository at this point in the history
Fix: Remove HMR attempts in Prod~!
  • Loading branch information
Rich-Harris authored Feb 6, 2018
2 parents a85f292 + 7a2ed16 commit 4f8ce19
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
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

0 comments on commit 4f8ce19

Please sign in to comment.