Skip to content

Commit

Permalink
test(dts-plugin): improve test cases of archive handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy committed Dec 12, 2024
1 parent ff7d8d9 commit c6f2c41
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 158 deletions.
21 changes: 17 additions & 4 deletions apps/manifest-demo/3010-rspack-provider/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = composePlugins(
transform: {
react: {
runtime: 'automatic',
refresh: true,
},
},
},
Expand All @@ -60,6 +61,18 @@ module.exports = composePlugins(
// publicPath must be specific url
config.output.publicPath = 'http://localhost:3010/';

const rspackPlugin = config.plugins.find((plugin) => {
return plugin.name === 'HtmlRspackPlugin';
});

if (rspackPlugin && rspackPlugin._args && rspackPlugin._args[0]) {
rspackPlugin._args[0].excludeChunks = ['rspack_provider'];
} else {
console.warn(
'HtmlRspackPlugin not found or has unexpected structure. Skipping excludeChunks configuration.',
);
}

config.plugins.push(
new ModuleFederationPlugin({
name: 'rspack_provider',
Expand All @@ -70,10 +83,10 @@ module.exports = composePlugins(
shared: {
lodash: {},
antd: {},
'react/': {
singleton: true,
requiredVersion: '^18.3.1',
},
// 'react/': {
// singleton: true,
// requiredVersion: '^18.3.1',
// },
react: {
singleton: true,
requiredVersion: '^18.3.1',
Expand Down
1 change: 1 addition & 0 deletions apps/react-ts-host/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = composePlugins(
withNx(),
withReact(),
async (config, context) => {
config.devServer = config.devServer || {};
config.devServer.host = '127.0.0.1';
// prevent cyclic updates
config.watchOptions = {
Expand Down
4 changes: 0 additions & 4 deletions packages/dts-plugin/src/plugins/GenerateTypesPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
zipPrefix = path.dirname(config.filename);
}

debugger;

if (zipTypesPath) {
const zipContent = fs.readFileSync(zipTypesPath);
const zipOutputPath = path.join(
Expand All @@ -105,7 +103,6 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
await new Promise<void>((resolve, reject) => {
compiler.outputFileSystem.mkdir(
path.dirname(zipOutputPath),
{ recursive: true },
(err) => {
if (err) reject(err);
else {
Expand Down Expand Up @@ -133,7 +130,6 @@ export class GenerateTypesPlugin implements WebpackPluginInstance {
await new Promise<void>((resolve, reject) => {
compiler.outputFileSystem.mkdir(
path.dirname(apiOutputPath),
{ recursive: true },
(err) => {
if (err) reject(err);
else {
Expand Down
Loading

0 comments on commit c6f2c41

Please sign in to comment.