UNPKG

1.19 kBMarkdownView Raw
1由于 Ykit 是基于 Webpack 的,因此迁移 Webapck 项目只需要原有配置进行迁移。
2
3<h2 style="font-weight: normal"> 1. 创建配置文件 </h2>
4
5在项目目录下创建一个名为 `ykit.js` 的配置文件(如果使用某种类型的插件,则为 `ykit.{type}.js`),配置文件示例可参考 [Ykit-配置][1]。
6
7<h2 style="font-weight: normal"> 2. 配置 modifyWebpackConfig </h2>
8
9编辑配置文件,以下为配置示例:
10```
11var webpackConfig = require('webpack.config.js')
12
13exports.config = function() {
14 return {
15 export: [], // 在 modifyWebpackConfig 中配置原有入口,所以这里留空
16 modifyWebpackConfig: function(baseConfig) {
17 // 配置入口
18 baseConfig.entry = webpackConfig.entry;
19 // 配置编译方式
20 baseConfig.module = webpackConfig.module;
21 // 迁移更多自定义的配置
22 // ...
23
24 return baseConfig;
25 }
26 };
27};
28```
29
30具体配置文档可参考 [Ykit-配置][1]。
31
32<h2 style="font-weight: normal"> 3. 执行 ykit pack 验证编译打包结果 </h2>
33
34默认会打包至项目的 `dev` 目录下。
35
36[1]: ./docs-配置.html