Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit a2e6712

Browse files
authored
refactor: remove tns-xml-loader and ExcludeUnusedElementsPlugin (#90)
Migration: remove the loader and plugin from your webpack config closes #79, #88
1 parent ad965ed commit a2e6712

File tree

4 files changed

+0
-123
lines changed

4 files changed

+0
-123
lines changed

Diff for: index.js

-35
Original file line numberDiff line numberDiff line change
@@ -40,41 +40,6 @@ exports.NativeScriptJsonpPlugin.prototype.apply = function (compiler) {
4040
});
4141
};
4242

43-
exports.ExcludeUnusedElementsPlugin = function () {
44-
};
45-
46-
exports.ExcludeUnusedElementsPlugin.prototype.apply = function (compiler) {
47-
compiler.plugin("normal-module-factory", function (nmf) {
48-
nmf.plugin("before-resolve", function (result, callback) {
49-
if (!result) {
50-
return callback();
51-
}
52-
53-
if (result.request === "globals" || result.request === "ui/core/view") {
54-
return callback(null, result);
55-
}
56-
57-
if (result.context.indexOf("tns-core-modules") === -1) {
58-
if (result.contextInfo.issuer &&
59-
result.contextInfo.issuer.indexOf("element-registry") !== -1 && global.ELEMENT_REGISTRY &&
60-
!global.ELEMENT_REGISTRY[result.request]) {
61-
return callback();
62-
63-
} else {
64-
return callback(null, result);
65-
}
66-
}
67-
68-
if (result.contextInfo.issuer.indexOf("bundle-entry-points") !== -1 && global.ELEMENT_REGISTRY &&
69-
!global.ELEMENT_REGISTRY[result.request]) {
70-
return callback();
71-
}
72-
73-
return callback(null, result);
74-
});
75-
});
76-
};
77-
7843
exports.GenerateBundleStarterPlugin = function (bundles) {
7944
this.bundles = bundles;
8045
};

Diff for: installer.js

-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ function getProjectDependencies() {
133133
dependencies["@angular/compiler-cli"] = "~2.4.3";
134134
dependencies["@ngtools/webpack"] = "1.2.10";
135135
dependencies["typescript"] = "^2.0.10";
136-
dependencies["htmlparser2"] = "~3.9.2";
137136
} else {
138137
dependencies["awesome-typescript-loader"] = "~3.0.0-beta.9";
139138
}

Diff for: tns-xml-loader.js

-81
This file was deleted.

Diff for: webpack.common.js.angular.template

-6
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ module.exports = function (platform, destinationApp) {
4444
"./bundle",
4545
]),
4646

47-
// Exclude explicitly required but never declared in XML elements.
48-
// Loader nativescript-dev-webpack/tns-xml-loader should be added for *.xml/html and *.ts files.
49-
new nsWebpack.ExcludeUnusedElementsPlugin(),
50-
5147
//Angular AOT compiler
5248
new AotPlugin({
5349
tsConfigPath: "tsconfig.aot.json",
@@ -112,7 +108,6 @@ module.exports = function (platform, destinationApp) {
112108
test: /\.html$|\.xml$/,
113109
loaders: [
114110
"raw-loader",
115-
"nativescript-dev-webpack/tns-xml-loader",
116111
]
117112
},
118113
// Root app.css file gets extracted with bundled dependencies
@@ -138,7 +133,6 @@ module.exports = function (platform, destinationApp) {
138133
loaders: [
139134
"nativescript-dev-webpack/tns-aot-loader",
140135
"@ngtools/webpack",
141-
"nativescript-dev-webpack/tns-xml-loader",
142136
]
143137
},
144138
// SASS support

0 commit comments

Comments
 (0)