Skip to content

Commit

Permalink
Document workaround for Svelte errors
Browse files Browse the repository at this point in the history
In Webpack 5+, this is required to load Svelte correctly, due to what appears to be code generation issues with TypeScript:

microsoft/TypeScript#16577

This works around that by using telling end users to use a newly added feature in Webpack 5+, that uses Webpack 4 behavior for resolving module names:

https://webpack.js.org/configuration/module/#resolvefullyspecified
  • Loading branch information
syvb committed Oct 28, 2020
1 parent d4e2c20 commit f2a7494
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ Configure inside your `webpack.config.js`:
test: /\.(html|svelte)$/,
exclude: /node_modules/,
use: 'svelte-loader'
}
},
// Only include this when using Webpack 5+
{
test: /node_modules\/svelte\/.*\.mjs$/,
resolve: {
fullySpecified: false // load Svelte correctly
}
},
...
]
}
Expand Down

0 comments on commit f2a7494

Please sign in to comment.