Skip to content

Commit

Permalink
fix: manifest assets
Browse files Browse the repository at this point in the history
  • Loading branch information
HomyeeKing committed Jan 15, 2025
1 parent 1a36504 commit d6d3f04
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/ice/src/service/serverCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export function createServerCompiler(options: Options) {
}

const format = customBuildOptions?.format || 'esm';

let buildOptions: esbuild.BuildOptions = {
bundle: true,
format,
Expand Down
14 changes: 13 additions & 1 deletion packages/ice/src/service/webpackServerCompiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class WebpackServerCompiler {
},
resolve: {
alias: options.alias,
fallback: { crypto: false },
extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '...'],
plugins: [
new TsconfigPathsPlugin({
Expand All @@ -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',
Expand Down Expand Up @@ -102,6 +113,7 @@ export class WebpackServerCompiler {
},
plugins: [
...options.plugins,
new webpack.DefinePlugin(options.define),
new webpack.SourceMapDevToolPlugin({
// remove append sourcemap comment
append: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit d6d3f04

Please sign in to comment.