请问要在已经安装webpack项目中使用webpack,还需要做什么配置才能使用呢?

作者站长头像
站长
· 阅读数 15

我使用electron-react 模板 创建了electron项目,请问要在已经安装webpack项目中使用webpack,还需要做什么配置才能使用呢?我看到有安装webpack组件

请问要在已经安装webpack项目中使用webpack,还需要做什么配置才能使用呢?

回复
1个回答
avatar
test
2024-07-20

你按照项目里的readme去做就可以开始开发了啊,不用操心如何配置webpack,这也是你使用框架的意义

另外,如果你强行要修改webpack的配置的话,可以看package.json内容

{
  // ...
  "script": {
    // ...
    "start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
    "start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
  }
}

执行npm run start的时候,会去执行npm run start:renderer,在npm run start:renderer里有指定一个./.erb/configs/webpack.config.renderer.dev.ts的webpack配置文件,你要改webpack配置的话,应该可以通过改这个文件来实现.

以下为项目readme的摘录

Install

Clone the repo and install dependencies:

git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
cd your-project-name
npm install

Having issues installing? See our debugging guide

Starting Development

Start the app in the dev environment:

npm start

Packaging for Production

To package apps for the local platform:

npm run package
回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容