diff --git a/packages/ice/src/service/serverCompiler.ts b/packages/ice/src/service/serverCompiler.ts index 501a0a16c9..9d6e29db9c 100644 --- a/packages/ice/src/service/serverCompiler.ts +++ b/packages/ice/src/service/serverCompiler.ts @@ -188,7 +188,6 @@ export function createServerCompiler(options: Options) { } const format = customBuildOptions?.format || 'esm'; - let buildOptions: esbuild.BuildOptions = { bundle: true, format, diff --git a/packages/ice/src/service/webpackServerCompiler/compiler.ts b/packages/ice/src/service/webpackServerCompiler/compiler.ts index 7665f8dda8..edec6232d2 100644 --- a/packages/ice/src/service/webpackServerCompiler/compiler.ts +++ b/packages/ice/src/service/webpackServerCompiler/compiler.ts @@ -61,6 +61,7 @@ export class WebpackServerCompiler { }, resolve: { alias: options.alias, + fallback: { crypto: false }, extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '...'], plugins: [ new TsconfigPathsPlugin({ @@ -74,7 +75,17 @@ export class WebpackServerCompiler { { // // Match `.js`, `.jsx`, `.ts` or `.tsx` files test: /\.m?[jt]sx?$/, - exclude: /node_modules/, + exclude(path) { + // TODO: more universal + if (path.includes('node_modules')) { + if (path.includes('@ali/alimod-ufirst-bottom-bar')) { + return false; + } else { + return true; + } + } + return false; + }, use: [ { loader: 'esbuild-loader', @@ -102,6 +113,7 @@ export class WebpackServerCompiler { }, plugins: [ ...options.plugins, + new webpack.DefinePlugin(options.define), new webpack.SourceMapDevToolPlugin({ // remove append sourcemap comment append: false, diff --git a/packages/ice/src/service/webpackServerCompiler/removeMagicString.ts b/packages/ice/src/service/webpackServerCompiler/removeMagicString.ts index 7e0d49813d..cd4e0a5f46 100644 --- a/packages/ice/src/service/webpackServerCompiler/removeMagicString.ts +++ b/packages/ice/src/service/webpackServerCompiler/removeMagicString.ts @@ -1,5 +1,5 @@ export default function (source) { - const result = source.replace(/webpackChunkName:\s*["'][^"']+["']/g, 'webpackIgnore: true'); + const result = source.replace(/webpackChunkName:\s*["'][^"']+["']/g, ''); // Return the modified source return result; diff --git a/packages/ice/src/service/webpackServerCompiler/virtualAssetPlugin.ts b/packages/ice/src/service/webpackServerCompiler/virtualAssetPlugin.ts index ed5ed8306f..a911c65b58 100644 --- a/packages/ice/src/service/webpackServerCompiler/virtualAssetPlugin.ts +++ b/packages/ice/src/service/webpackServerCompiler/virtualAssetPlugin.ts @@ -57,8 +57,8 @@ class VirtualManifestPlugin { NormalModule.getCompilationHooks(compilation) .readResource.for('virtual') .tap(PLUGIN_NAME, () => { - const manifest = this.generateManifestContent() || ''; - return JSON.stringify(manifest); + const manifest = this.generateManifestContent(); + return JSON.stringify(manifest?.assetsManifest || ''); }); normalModuleFactory.hooks.beforeResolve.tap(PLUGIN_NAME, (resolveData) => { if (resolveData.request === 'virtual:assets-manifest.json') {