Skip to content
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

fix webpack 4 compatibility #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/NsJsonpChunkTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ JsonpChunkTemplatePlugin.prototype.apply = function (chunkTemplate) {

//JSONP version
chunkTemplate.plugin("render", function (modules, chunk) {
var jsonpFunction = this.outputOptions.jsonpFunction;
var jsonpFunction = chunkTemplate.outputOptions.jsonpFunction;
var source = new ConcatSource();
source.add(jsonpFunction + "(" + JSON.stringify(chunk.ids) + ",");
source.add(modules);
Expand All @@ -28,7 +28,7 @@ JsonpChunkTemplatePlugin.prototype.apply = function (chunkTemplate) {
chunkTemplate.plugin("hash", function (hash) {
hash.update("JsonpChunkTemplatePlugin");
hash.update("3");
hash.update(this.outputOptions.jsonpFunction + "");
hash.update(this.outputOptions.library + "");
hash.update(chunkTemplate.outputOptions.jsonpFunction + "");
hash.update(chunkTemplate.outputOptions.library + "");
});
};
6 changes: 3 additions & 3 deletions lib/NsJsonpHotUpdateChunkTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = NsJsonpHotUpdateChunkTemplatePlugin;
//JSONP version
NsJsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {
hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, removedModules, hash, id) {
var jsonpFunction = this.outputOptions.hotUpdateFunction;
var jsonpFunction = hotUpdateChunkTemplate.outputOptions.hotUpdateFunction;
var source = new ConcatSource();
source.add(jsonpFunction + "(" + JSON.stringify(id) + ",");
source.add(modulesSource);
Expand All @@ -21,7 +21,7 @@ NsJsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTem
hotUpdateChunkTemplate.plugin("hash", function(hash) {
hash.update("JsonpHotUpdateChunkTemplatePlugin");
hash.update("3");
hash.update(this.outputOptions.hotUpdateFunction + "");
hash.update(this.outputOptions.library + "");
hash.update(hotUpdateChunkTemplate.outputOptions.hotUpdateFunction + "");
hash.update(hotUpdateChunkTemplate.outputOptions.library + "");
});
};
18 changes: 9 additions & 9 deletions lib/NsJsonpMainTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ JsonpMainTemplatePlugin.prototype.apply = function (mainTemplate) {
});

mainTemplate.plugin("require-ensure", function (_, chunk, hash) {
var chunkFilename = this.outputOptions.chunkFilename;
var chunkFilename = mainTemplate.outputOptions.chunkFilename;
var chunkMaps = chunk.getChunkMaps();
var insertMoreModules = [
"var moreModules = chunk.modules, chunkIds = chunk.ids;",
Expand Down Expand Up @@ -77,7 +77,7 @@ JsonpMainTemplatePlugin.prototype.apply = function (mainTemplate) {
});
mainTemplate.plugin("bootstrap", function (source, chunk, hash) {
if (chunk.chunks.length > 0) {
var jsonpFunction = this.outputOptions.jsonpFunction;
var jsonpFunction = mainTemplate.outputOptions.jsonpFunction;
return this.asString([
source,
"",
Expand Down Expand Up @@ -123,9 +123,9 @@ JsonpMainTemplatePlugin.prototype.apply = function (mainTemplate) {
return source;
});
mainTemplate.plugin("hot-bootstrap", function (source, chunk, hash) {
var hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
var hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
var hotUpdateFunction = this.outputOptions.hotUpdateFunction;
var hotUpdateChunkFilename = mainTemplate.outputOptions.hotUpdateChunkFilename;
var hotUpdateMainFilename = mainTemplate.outputOptions.hotUpdateMainFilename;
var hotUpdateFunction = mainTemplate.outputOptions.hotUpdateFunction;
var currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
hashWithLength: function (length) {
Expand Down Expand Up @@ -157,9 +157,9 @@ JsonpMainTemplatePlugin.prototype.apply = function (mainTemplate) {
mainTemplate.plugin("hash", function (hash) {
hash.update("jsonp");
hash.update("4");
hash.update(this.outputOptions.filename + "");
hash.update(this.outputOptions.chunkFilename + "");
hash.update(this.outputOptions.jsonpFunction + "");
hash.update(this.outputOptions.hotUpdateFunction + "");
hash.update(mainTemplate.outputOptions.filename + "");
hash.update(mainTemplate.outputOptions.chunkFilename + "");
hash.update(mainTemplate.outputOptions.jsonpFunction + "");
hash.update(mainTemplate.outputOptions.hotUpdateFunction + "");
});
};
6 changes: 3 additions & 3 deletions lib/NsJsonpTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function JsonpTemplatePlugin() {}
module.exports = JsonpTemplatePlugin;
JsonpTemplatePlugin.prototype.apply = function(compiler) {
compiler.plugin("this-compilation", function(compilation) {
compilation.mainTemplate.apply(new NsJsonpMainTemplatePlugin());
compilation.chunkTemplate.apply(new NsJsonpChunkTemplatePlugin());
compilation.hotUpdateChunkTemplate.apply(new NsJsonpHotUpdateChunkTemplatePlugin());
compilation.mainTemplate.apply(new NsJsonpMainTemplatePlugin(compilation.mainTemplate));
compilation.chunkTemplate.apply(new NsJsonpChunkTemplatePlugin(compilation.chunkTemplate));
compilation.hotUpdateChunkTemplate.apply(new NsJsonpHotUpdateChunkTemplatePlugin(compilation.hotUpdateChunkTemplate));
});
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "nativescript-vue-target",
"version": "0.1.0",
"version": "0.2.0",
"description": "Webpack target for NativeScript-Vue",
"main": "index.js",
"peerDependencies": {
"webpack": "3.x"
"webpack": "3.x || 4.x"
},
"repository": {
"type": "git",
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy