mirror of https://github.com/alibaba/ice.git
Compare commits
2 Commits
1a08895dc5
...
bb60ab5a04
| Author | SHA1 | Date |
|---|---|---|
|
|
bb60ab5a04 | |
|
|
412faf03d1 |
|
|
@ -1,5 +1,11 @@
|
||||||
# @ice/plugin-externals
|
# @ice/plugin-externals
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 4569200ca: fix: support externals field in assets-manifest
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/plugin-externals",
|
"name": "@ice/plugin-externals",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "plugin to make externals much easier in ice.js",
|
"description": "plugin to make externals much easier in ice.js",
|
||||||
"files": [
|
"files": [
|
||||||
"esm",
|
"esm",
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ export default class InjectExternalScriptsWebpackPlugin {
|
||||||
if (assetsManifest) {
|
if (assetsManifest) {
|
||||||
const json = JSON.parse(assetsManifest.source().toString());
|
const json = JSON.parse(assetsManifest.source().toString());
|
||||||
delete compilation.assets[ASSET_MANIFEST_JSON_NAME];
|
delete compilation.assets[ASSET_MANIFEST_JSON_NAME];
|
||||||
json.entries.main.unshift(...this.options.externals);
|
// Ensure externals array exists and add new externals at the beginning.
|
||||||
|
json.externals ||= [];
|
||||||
|
json.externals.unshift(...this.options.externals);
|
||||||
compilation.emitAsset(
|
compilation.emitAsset(
|
||||||
ASSET_MANIFEST_JSON_NAME,
|
ASSET_MANIFEST_JSON_NAME,
|
||||||
new webpack.sources.RawSource(JSON.stringify(json)),
|
new webpack.sources.RawSource(JSON.stringify(json)),
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
"webpack-dev-server": "4.15.0"
|
"webpack-dev-server": "4.15.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ice/app": "^3.6.4",
|
"@ice/app": "^3.6.3",
|
||||||
"@ice/runtime": "^1.5.4"
|
"@ice/runtime": "^1.5.4"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
"sax": "^1.2.4"
|
"sax": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ice/app": "^3.6.4",
|
"@ice/app": "^3.6.3",
|
||||||
"@ice/runtime": "^1.5.4",
|
"@ice/runtime": "^1.5.4",
|
||||||
"webpack": "^5.88.0"
|
"webpack": "^5.88.0"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# @ice/plugin-stream-error
|
# @ice/plugin-stream-error
|
||||||
|
|
||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
- feat: empty root element when stream error
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/plugin-stream-error",
|
"name": "@ice/plugin-stream-error",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,16 @@ import type { Plugin } from '@ice/app/types';
|
||||||
|
|
||||||
interface PluginOptions {
|
interface PluginOptions {
|
||||||
activeInDev?: boolean;
|
activeInDev?: boolean;
|
||||||
|
rootId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PLUGIN_NAME = '@ice/plugin-stream-error';
|
const PLUGIN_NAME = '@ice/plugin-stream-error';
|
||||||
const plugin: Plugin<PluginOptions> = (options = {}) => ({
|
const plugin: Plugin<PluginOptions> = (options = {
|
||||||
|
rootId: 'root',
|
||||||
|
}) => ({
|
||||||
name: PLUGIN_NAME,
|
name: PLUGIN_NAME,
|
||||||
setup: ({ generator, context }) => {
|
setup: ({ generator, context }) => {
|
||||||
const { activeInDev } = options;
|
const { activeInDev, rootId } = options;
|
||||||
const { userConfig } = context;
|
const { userConfig } = context;
|
||||||
if (userConfig.ssr) {
|
if (userConfig.ssr) {
|
||||||
generator.addEntryCode((originalCode) => {
|
generator.addEntryCode((originalCode) => {
|
||||||
|
|
@ -18,6 +21,11 @@ if (import.meta.renderer === 'client') {
|
||||||
// _$ServerTimePoints will returned at the end of last stream,
|
// _$ServerTimePoints will returned at the end of last stream,
|
||||||
// if the value is undefined, try to re-render app with CSR.
|
// if the value is undefined, try to re-render app with CSR.
|
||||||
if (${activeInDev ? '' : 'process.env.NODE_ENV === \'production\' && '}!window._$ServerTimePoints && window.__ICE_APP_CONTEXT__.renderMode === 'SSR') {
|
if (${activeInDev ? '' : 'process.env.NODE_ENV === \'production\' && '}!window._$ServerTimePoints && window.__ICE_APP_CONTEXT__.renderMode === 'SSR') {
|
||||||
|
const root = document.getElementById('${rootId}');
|
||||||
|
if (root) {
|
||||||
|
root.innerHTML = '';
|
||||||
|
}
|
||||||
|
window.__ICE_APP_CONTEXT__.renderMode = 'CSR';
|
||||||
render({ hydrate: false });
|
render({ hydrate: false });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
# @ice/runtime
|
# @ice/runtime
|
||||||
|
|
||||||
|
## 1.5.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 4569200ca: fix: support externals field in assets-manifest
|
||||||
|
|
||||||
## 1.5.4
|
## 1.5.4
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/runtime",
|
"name": "@ice/runtime",
|
||||||
"version": "1.5.4",
|
"version": "1.5.5",
|
||||||
"description": "Runtime module for ice.js",
|
"description": "Runtime module for ice.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./esm/index.d.ts",
|
"types": "./esm/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,9 @@ export const Scripts: ScriptsType = (props: ScriptsProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Data ScriptElement={ScriptElement} />
|
<Data ScriptElement={ScriptElement} />
|
||||||
|
{assetsManifest.externals?.map(external => (
|
||||||
|
<ScriptElement key={external} src={external} {...rest} data-external-script />
|
||||||
|
))}
|
||||||
{
|
{
|
||||||
routeScripts.map(routeScriptProps => {
|
routeScripts.map(routeScriptProps => {
|
||||||
return <ScriptElement key={routeScriptProps.src} {...rest} {...routeScriptProps} data-route-script />;
|
return <ScriptElement key={routeScriptProps.src} {...rest} {...routeScriptProps} data-route-script />;
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,7 @@ export interface RouteModules {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssetsManifest {
|
export interface AssetsManifest {
|
||||||
|
externals?: string[];
|
||||||
dataLoader?: string;
|
dataLoader?: string;
|
||||||
publicPath: string;
|
publicPath: string;
|
||||||
entries: {
|
entries: {
|
||||||
|
|
|
||||||
|
|
@ -2157,7 +2157,7 @@ importers:
|
||||||
version: 1.2.4
|
version: 1.2.4
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@ice/app':
|
'@ice/app':
|
||||||
specifier: ^3.6.4
|
specifier: ^3.6.3
|
||||||
version: link:../ice
|
version: link:../ice
|
||||||
'@ice/runtime':
|
'@ice/runtime':
|
||||||
specifier: ^1.5.4
|
specifier: ^1.5.4
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue