Skip to content

Commit

Permalink
fix: temporary fix for #49 (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgozi authored and DeMoorJasper committed Aug 4, 2019
1 parent bbb239e commit ebc96a3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/parcel-plugin-svelte/src/svelte-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class SvelteAsset extends Asset {
async getConfig() {
let config = (await super.getConfig(['.svelterc', 'svelte.config.js', 'package.json'])) || {};
config = config.svelte || config;

// If somebody use svelte field as a path to unprocessed sources
// @see https://github.com/rollup/rollup-plugin-svelte#pkgsvelte
if (config == null || typeof config !== "object") {
if (config == null || typeof config !== 'object') {
config = {};
}

Expand Down Expand Up @@ -89,7 +89,8 @@ class SvelteAsset extends Asset {
let { css, js } = compile(this.contents, compilerOptions);
let { map, code } = js;

if (process.env.NODE_ENV !== 'production' && this.options.hmr) {
// Enable HMR only on svelte 2.x or below
if (this.options.hmr && major_version < 3) {
code = makeHot(compilerOptions.filename, code, this);
}

Expand Down

0 comments on commit ebc96a3

Please sign in to comment.