Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Fix: hmr fail #189

Merged
merged 3 commits into from
May 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/webpack-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ function getEntry(rootDir: string) {
// use generated file in template directory
entryFile = path.join(rootDir, '.ice/entry.client.ts');
}
const dataLoaderFile = path.join(rootDir, '.ice/data-loader.ts');
return {
loader: [path.join(rootDir, '.ice/data-loader.ts')],
runtime: ['react', 'react-dom', '@ice/runtime'],
main: {
import: [entryFile],
dependOn: 'runtime',
},
// Should set `dependOn` property to avoid hmr fail.
// ref: https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/88#issuecomment-627558799
loader: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

调整顺序就可以解决吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

主要是要加 dependOn

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以加个注释,贴下 issue 地址?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import: [dataLoaderFile],
dependOn: 'runtime',
},
};
}

Expand Down