Skip to content

Commit

Permalink
fix: compatible with case which icejs verison is locked (#4257)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Apr 22, 2021
1 parent d8db0c3 commit c04316e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "1.17.5",
"version": "1.17.6",
"description": "command line interface and builtin plugin for icejs",
"author": "[email protected]",
"homepage": "",
Expand Down
3 changes: 3 additions & 0 deletions packages/icejs/src/getBuiltInPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const getBuiltInPlugins: IGetBuiltInPlugins = (userConfig) => {
'build-plugin-ice-mpa'
];
}
// eslint-disable-next-line
const pkg = require('../package.json');
process.env.__FRAMEWORK_VERSION__ = pkg.version;
const coreOptions = {
'framework': 'react',
'alias': process.env.__FRAMEWORK_NAME__ || 'ice'
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-icestark/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 2.0.9

- [fix] compatible with the case which icejs version is locked

# 2.0.8

- [fix] make `router.basename` work in a non-icestark context. ([#4234](https://github.com/alibaba/ice/issues/4234))
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-icestark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const plugin: IPlugin = async ({ onGetWebpackConfig, getValue, applyMethod, cont

const hasDefaultLayout = glob.sync(`${path.join(rootDir, 'src/layouts/index')}.@(ts?(x)|js?(x))`).length;
onGetWebpackConfig((config) => {
config
.plugin('DefinePlugin')
.tap(([args]) => [{ ...args, 'process.env.__FRAMEWORK_VERSION__': JSON.stringify(process.env.__FRAMEWORK_VERSION__) }]);
// set alias for default layout
config.resolve.alias.set('$ice/Layout', hasDefaultLayout ? path.join(rootDir, 'src/layouts') : path.join(__dirname, 'runtime/Layout'));
// set alias for icestark
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-icestark/src/runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ const module = ({ appConfig, addDOMRender, buildConfig, setRenderRouter, wrapper
fallback
};

if (wrapperRouterRender) {
// compatible with the case which lock icejs version
if (wrapperRouterRender && !!process.env.__FRAMEWORK_VERSION__) {
wrapperRouterRender((originRender) => (routes, RoutesComponent) => {
return originRender(routes, RoutesComponent, routerProps);
});
Expand Down

0 comments on commit c04316e

Please sign in to comment.