Skip to content
This repository has been 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

Fix: Remove HMR attempts in Prod~! #114

merged 1 commit into from
Feb 6, 2018

Conversation

lukeed
Copy link
Member

@lukeed lukeed commented Feb 5, 2018

In production apps, there were still attempts made to /__webpack_hmr, which meant that the dev-entry was being included.

The short-fix was to modify the build script: NODE_ENV=production sapper build ... but that's still ugly & not the intended.

I added some debuggers and saw that the dev block of create_app was still running. Then took a look at the compiled cli.js output:

screen shot 2018-02-05 at 2 09 04 pm

The dev check is made before manually setting the NODE_ENV. Also, because of Rollup's "import hoisting" (is that the term?) moving this line to the top of the file, ahead of the dev import, didn't affect the compiled output.

Simply converting config.dev to config.isDev() solves this, deferring the check until needed.

Now, sapper build && sapper start works as expected, while preserving HMR for dev-mode. 馃帀

@lukeed lukeed mentioned this pull request Feb 6, 2018
@Rich-Harris
Copy link
Member

I wish I'd thunk of this

...

...

[tumbleweed]

@Rich-Harris Rich-Harris merged commit 4f8ce19 into sveltejs:master Feb 6, 2018
@lukeed lukeed deleted the fix/prod-hmr branch February 6, 2018 15:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants