diff --git a/index.js b/index.js index 8ab13cce..8c8122e4 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ const { basename, extname, relative } = require('path'); const { compile, preprocess } = require('svelte'); const { getOptions } = require('loader-utils'); const VirtualModules = require('./lib/virtual'); +const requireRelative = require('require-relative'); const hotApi = require.resolve('./lib/hot-api.js'); @@ -95,7 +96,7 @@ module.exports = function(source, map) { options.filename = this.resourcePath; if (!('format' in options)) options.format = 'es'; - if (!('shared' in options)) options.shared = options.format === 'es' && 'svelte/shared.js'; + if (!('shared' in options)) options.shared = options.format === 'es' && requireRelative.resolve('svelte/shared.js', process.cwd()); if (!('name' in options)) options.name = capitalize(sanitize(options.filename)); if (!('onwarn' in options)) options.onwarn = warning => this.emitWarning(new Error(warning)); if (options.emitCss) options.css = false; diff --git a/package.json b/package.json index 159bcd6f..7160a679 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ ], "dependencies": { "loader-utils": "^1.1.0", + "require-relative": "^0.8.7", "svelte-dev-helper": "^1.1.7" }, "devDependencies": {