-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
base: master
Are you sure you want to change the base?
Conversation
* 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
export default defineConfig({ | ||
plugins: [ | ||
mockViewer( | ||
// port: 9006, // 可以自定义端口 |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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'; | ||
|
||
|
There was a problem hiding this comment.
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 可选,插件名称 |
There was a problem hiding this comment.
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 = []; |
There was a problem hiding this comment.
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 插件 |
There was a problem hiding this 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的引入会和 bundles 里面的那一份冲突吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundles 目前固定的版本是 4.10.0
There was a problem hiding this 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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该有这个依赖吧?
这种需求是不是直接建议用 configureWebpack 配置去添加 webpack 插件就好了, 不需要再独立包一个 ice 的插件 |
Add plugin mock viewer to manage local mock data. Author @BuggMaker