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

feat: add plugin-mock-viewer to manage local mock data #6024

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ClarkXia
Copy link
Collaborator

@ClarkXia ClarkXia commented Mar 7, 2023

Add plugin mock viewer to manage local mock data. Author @BuggMaker

BuggMaker and others added 2 commits March 7, 2023 11:53
* feat: add plugin-mock-viewer to manage local mock data

* chore: add webpack-mock-viewer to pnpm-lock

* fix: pnpm-lock conflict

* fix: pnpm-lock conflict

* fix: ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY

* chore: reset pnpm-lock

* chore: reset pnpm-lock
@ClarkXia ClarkXia requested review from luhc228 and wssgcg1213 March 7, 2023 06:32
@ClarkXia ClarkXia added the need review Need Review label Mar 7, 2023
export default defineConfig({
plugins: [
mockViewer(
// port: 9006, // 可以自定义端口
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个传入的是对象?

"watch": "tsc -w",
"build": "tsc"
},
"dependencies": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

dependencies 移动到 devDep 上面去

import type { WebpackMockViewerOptions } from 'webpack-mock-viewer';
import WebpackMockViewer from 'webpack-mock-viewer';


Copy link
Collaborator

Choose a reason for hiding this comment

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

多了一个空行



const mockViewer: Plugin<WebpackMockViewerOptions> = (options?: WebpackMockViewerOptions) => ({
// name 可选,插件名称
Copy link
Collaborator

Choose a reason for hiding this comment

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

注释用英文, 这里没必要的可以删掉

setup: ({ context, onGetConfig }) => {
onGetConfig((webpackConfig) => {
if (context.command === 'start') {
if (!webpackConfig.plugins) webpackConfig.plugins = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以用 ??=

onGetConfig((webpackConfig) => {
if (context.command === 'start') {
if (!webpackConfig.plugins) webpackConfig.plugins = [];
// 添加 webpack 插件
Copy link
Collaborator

Choose a reason for hiding this comment

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

这种注释不要

@@ -21688,6 +21790,53 @@ packages:
schema-utils: 4.0.0
webpack: 5.75.0_ncbsfugu56ddhgadp34k4kpsue

/webpack-dev-server/4.11.1:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的引入会和 bundles 里面的那一份冲突吗

Copy link
Collaborator

Choose a reason for hiding this comment

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

bundles 目前固定的版本是 4.10.0

Copy link
Collaborator

@wssgcg1213 wssgcg1213 left a comment

Choose a reason for hiding this comment

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

再看看?

@@ -21688,6 +21790,53 @@ packages:
schema-utils: 4.0.0
webpack: 5.75.0_ncbsfugu56ddhgadp34k4kpsue

/webpack-dev-server/4.11.1:
Copy link
Collaborator

Choose a reason for hiding this comment

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

bundles 目前固定的版本是 4.10.0

@@ -12864,6 +12904,10 @@ packages:
sshpk: 1.17.0
dev: false

/http/0.0.1-security:
Copy link
Collaborator

Choose a reason for hiding this comment

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

不应该有这个依赖吧?

@ClarkXia ClarkXia removed the need review Need Review label Mar 7, 2023
Base automatically changed from release/next to master March 16, 2023 05:56
@wssgcg1213
Copy link
Collaborator

这种需求是不是直接建议用 configureWebpack 配置去添加 webpack 插件就好了, 不需要再独立包一个 ice 的插件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants