Skip to content

Commit 8f37468

Browse files
committed
Fix tree shaking for RESX files.
1 parent 0ff56a7 commit 8f37468

4 files changed

Lines changed: 12 additions & 21 deletions

File tree

build-tests/localization-plugin-test-02/src/strings5.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@
6363
<value>"RESX string with quotemarks"</value>
6464
<comment>RESX string with quotemarks</comment>
6565
</data>
66+
<data name="unusedString" xml:space="preserve">
67+
<value>UNUSED STRING</value>
68+
<comment>UNUSED STRING</comment>
69+
</data>
6670
</root>

common/config/rush/nonbrowser-approved-packages.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,6 @@
442442
"name": "jsdom",
443443
"allowedCategories": [ "libraries" ]
444444
},
445-
{
446-
"name": "json-loader",
447-
"allowedCategories": [ "libraries" ]
448-
},
449445
{
450446
"name": "loader-utils",
451447
"allowedCategories": [ "libraries" ]

webpack/localization-plugin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"@microsoft/node-core-library": "3.19.3",
3232
"lodash": "~4.17.15",
3333
"xmldoc": "~1.1.2",
34-
"json-loader": "~0.5.7",
3534
"chokidar": "~3.3.1"
3635
},
3736
"devDependencies": {

webpack/localization-plugin/src/WebpackConfigurationUpdater.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class WebpackConfigurationUpdater {
2626
exportAsDefault: options.exportAsDefault
2727
};
2828

29-
WebpackConfigurationUpdater._addLoadersForProvidedLocFiles(options, loader, loaderOptions);
29+
WebpackConfigurationUpdater._addLoadersForLocFiles(options, loader, loaderOptions);
3030

3131
WebpackConfigurationUpdater._tryUpdateLocaleTokenInPublicPathPlugin(options);
3232
}
@@ -47,13 +47,9 @@ export class WebpackConfigurationUpdater {
4747
},
4848
{
4949
test: Constants.RESX_REGEX,
50-
use: [
51-
require.resolve('json-loader'),
52-
{
53-
loader,
54-
options: loaderOptions
55-
}
56-
]
50+
loader: loader,
51+
options: loaderOptions,
52+
type: 'json'
5753
}
5854
]
5955
);
@@ -88,7 +84,7 @@ export class WebpackConfigurationUpdater {
8884
}
8985
}
9086

91-
private static _addLoadersForProvidedLocFiles(
87+
private static _addLoadersForLocFiles(
9288
options: IWebpackConfigurationUpdaterOptions,
9389
loader: string,
9490
loaderOptions: IBaseLoaderOptions
@@ -113,13 +109,9 @@ export class WebpackConfigurationUpdater {
113109
Constants.RESX_REGEX
114110
]
115111
},
116-
use: [
117-
require.resolve('json-loader'),
118-
{
119-
loader: loader,
120-
options: loaderOptions
121-
}
122-
]
112+
loader: loader,
113+
options: loaderOptions,
114+
type: 'json'
123115
}
124116
]
125117
);

0 commit comments

Comments
 (0)