Skip to content

Commit 288f8e7

Browse files
committed
bug #181 Fix new ts-loader rule being added when getWebpackConfig is called (Lyrkan)
This PR was merged into the master branch. Discussion ---------- Fix new ts-loader rule being added when getWebpackConfig is called Due to the following lines a new ts-loader rule is currently being added everytime the Webpack config is generated (for instance by calling `Encore.getWebpackConfig()`): https://github.com/symfony/webpack-encore/blob/c6057af7521594d9d76cfd072b1f2421591e4a3f/lib/config-generator.js#L196-L200 __Example:__ ```js // webpack.config.js const Encore = require('@symfony/webpack-encore'); Encore .setOutputPath('build') .setPublicPath('/') .addEntry('src/index.ts') .enableTypeScriptLoader() ; console.log(Encore.getWebpackConfig().module.rules.length); // => 5 console.log(Encore.getWebpackConfig().module.rules.length); // => 6 console.log(Encore.getWebpackConfig().module.rules.length); // => 7 ``` Commits ------- a2515b4 Fix ts-loader being added everytime getWebpackConfig is called
2 parents c6057af + a2515b4 commit 288f8e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/config-generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class ConfigGenerator {
193193
}
194194

195195
if (this.webpackConfig.useTypeScriptLoader) {
196-
this.webpackConfig.addLoader({
196+
rules.push({
197197
test: /\.tsx?$/,
198198
exclude: /node_modules/,
199199
use: tsLoaderUtil.getLoaders(this.webpackConfig)

0 commit comments

Comments
 (0)