react-loadable-ssr-addon
Advanced tools
Comparing version 0.3.0 to 1.0.0
@@ -21,2 +21,6 @@ "use strict"; | ||
var PLUGIN_NAME = 'ReactLoadableSSRAddon'; | ||
var WEBPACK_VERSION = require('webpack/package.json').version; | ||
var WEBPACK_5 = WEBPACK_VERSION.startsWith('5.'); | ||
var defaultOptions = { | ||
@@ -85,12 +89,14 @@ filename: 'assets-manifest.json', | ||
for (var i = 0; i < modules.length; i += 1) { | ||
var reasons = modules[i].reasons; | ||
if (!WEBPACK_5) { | ||
for (var i = 0; i < modules.length; i += 1) { | ||
var reasons = modules[i].reasons; | ||
for (var j = 0; j < reasons.length; j += 1) { | ||
var reason = reasons[j]; | ||
var type = reason.dependency ? reason.dependency.type : null; | ||
var userRequest = reason.dependency ? reason.dependency.userRequest : null; | ||
for (var j = 0; j < reasons.length; j += 1) { | ||
var reason = reasons[j]; | ||
var type = reason.dependency ? reason.dependency.type : null; | ||
var userRequest = reason.dependency ? reason.dependency.userRequest : null; | ||
if (type === 'import()') { | ||
origins.add(userRequest); | ||
if (type === 'import()') { | ||
origins.add(userRequest); | ||
} | ||
} | ||
@@ -113,8 +119,3 @@ } | ||
this.compiler = compiler; | ||
if (compiler.hooks) { | ||
compiler.hooks.emit.tapAsync(PLUGIN_NAME, this.handleEmit.bind(this)); | ||
} else { | ||
compiler.plugin('emit', this.handleEmit.bind(this)); | ||
} | ||
compiler.hooks.emit.tapAsync(PLUGIN_NAME, this.handleEmit.bind(this)); | ||
}; | ||
@@ -121,0 +122,0 @@ |
{ | ||
"name": "react-loadable-ssr-addon", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Server Side Render add-on for React Loadable. Load splitted chunks was never that easy.", | ||
@@ -39,3 +39,3 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=4.2.4" | ||
"node": ">=10.13.0" | ||
}, | ||
@@ -80,3 +80,4 @@ "resolutions": { | ||
"wait-for-expect": "^3.0.2", | ||
"webpack": "3.6.0" | ||
"webpack": "4.44.1", | ||
"webpack-cli": "^4.5.0" | ||
}, | ||
@@ -83,0 +84,0 @@ "husky": { |
@@ -340,4 +340,7 @@ # React Loadable SSR Add-on | ||
## Release History | ||
* 1.0.0 | ||
* BREAKING CHANGE: drop support for Webpack v3. | ||
* NEW: add [support for Webpack v5](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/260) | ||
* 0.3.0 | ||
* NEW: [`@babel/runtime` become a explicit dependency](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/22) by [@RDIL](https://github.com/RDIL) | ||
* NEW: [`@babel/runtime` become an explicit dependency](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/22) by [@RDIL](https://github.com/RDIL) | ||
> Requirement for `yarn v2`. | ||
@@ -407,3 +410,3 @@ * 0.2.3 | ||
⚡️ New feature (`:zap:`) | ||
🐛 Bug fix (`:bug:`) | ||
🐛 Bug fix (`:bug:`) | ||
🔥 P0 fix (`:fire:`) | ||
@@ -410,0 +413,0 @@ ✅ Tests (`:white_check_mark:`) |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -15,2 +15,6 @@ | ||
const WEBPACK_VERSION = require('webpack/package.json').version; | ||
const WEBPACK_5 = WEBPACK_VERSION.startsWith('5.'); | ||
// Default plugin options | ||
@@ -136,12 +140,17 @@ const defaultOptions = { | ||
const origins = new Set(); | ||
for (let i = 0; i < modules.length; i += 1) { | ||
const { reasons } = modules[i]; | ||
for (let j = 0; j < reasons.length; j += 1) { | ||
const reason = reasons[j]; | ||
const type = reason.dependency ? reason.dependency.type : null; | ||
const userRequest = reason.dependency | ||
? reason.dependency.userRequest | ||
: null; | ||
if (type === 'import()') { | ||
origins.add(userRequest); | ||
if (!WEBPACK_5) { | ||
// webpack 5 doesn't have 'reasons' on chunks any more | ||
// this is a dirty solution to make it work without throwing | ||
// an error, but does need tweaking to make everything work properly. | ||
for (let i = 0; i < modules.length; i += 1) { | ||
const { reasons } = modules[i]; | ||
for (let j = 0; j < reasons.length; j += 1) { | ||
const reason = reasons[j]; | ||
const type = reason.dependency ? reason.dependency.type : null; | ||
const userRequest = reason.dependency | ||
? reason.dependency.userRequest | ||
: null; | ||
if (type === 'import()') { | ||
origins.add(userRequest); | ||
} | ||
} | ||
@@ -169,10 +178,4 @@ } | ||
this.compiler = compiler; | ||
// check if webpack 4 `hooks` exists | ||
// otherwise, will fallback to the old syntax | ||
// @See {@Link https://webpack.js.org/api/compiler-hooks/} | ||
if (compiler.hooks) { | ||
compiler.hooks.emit.tapAsync(PLUGIN_NAME, this.handleEmit.bind(this)); | ||
} else { | ||
compiler.plugin('emit', this.handleEmit.bind(this)); | ||
} | ||
compiler.hooks.emit.tapAsync(PLUGIN_NAME, this.handleEmit.bind(this)); | ||
} | ||
@@ -179,0 +182,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 0.3.0 | ||
* @version 1.0.0 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
399144
1359
1
440
31