Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(preset-vue): yarn mode webpack require hook is invalid #12550

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/mf-v2-host/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@example/mf-v2-host",
"name": "@example/mfv2-host",
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.

不去掉 e2e 汇之星

"private": true,
"scripts": {
"build": "max build",
Expand Down
2 changes: 1 addition & 1 deletion examples/mf-v2-remote/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@example/mf-v2-remote",
"name": "@example/mfv2-remote",
"private": true,
"scripts": {
"build": "max build",
Expand Down
5 changes: 3 additions & 2 deletions packages/preset-vue/src/features/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
import { IApi } from 'umi';
import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js';
import { addAssetRules } from './assetRules';

export function getConfig(config: Config, api: IApi) {
Expand All @@ -23,7 +22,9 @@ export function getConfig(config: Config, api: IApi) {
babelParserPlugins: ['jsx', 'classProperties', 'decorators-legacy'],
});

config.plugin('vue-loader-plugin').use(VueLoaderPlugin);
const VueLoaderPlugin = require('vue-loader/dist/pluginWebpack5');
Copy link
Contributor

Choose a reason for hiding this comment

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

为啥现在不能在顶层 require 了啊。

Copy link
Member Author

Choose a reason for hiding this comment

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

yarn 模式下 webpack 取不到 应该是之前删除 require hook 的原因


config.plugin('vue-loader-plugin').use(VueLoaderPlugin.default);

// https://github.com/vuejs/vue-loader/issues/1435#issuecomment-869074949
config.module
Expand Down
Loading