From 68d25166434a938d6f7fde66005d06fdc2e457ef Mon Sep 17 00:00:00 2001 From: Joshua Crewe Date: Thu, 2 Apr 2020 09:27:04 +0100 Subject: [PATCH] Add webpack config from svelte webpack template This commit takes configuration found in the official svelte webpack template and includes it in this extension. The configuration is specific to svelte development and appears to reduce bugs introduced from including thirds party svelte libraries. --- src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.js b/src/index.js index 427b0b6..5d5d083 100644 --- a/src/index.js +++ b/src/index.js @@ -24,6 +24,20 @@ class Svelte { }; } + webpackConfig(webpackConfig) { + webpackConfig.resolve.mainFields = [ + 'svelte', + 'browser', + 'module', + 'main', + ]; + webpackConfig.resolve.extensions = ['.mjs', '.js', '.svelte']; + webpackConfig.resolve.alias.svelte = path.resolve( + 'node_modules', + 'svelte' + ); + } + boot() { let svelte = require("svelte"); let loader = require("svelte-loader");