-
Notifications
You must be signed in to change notification settings - Fork 0
/
amis.config.js
executable file
·132 lines (131 loc) · 4.47 KB
/
amis.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
'use strict';
const path = require('path');
// 统一路径解析
function resolve(dir) {
return path.resolve(__dirname, dir);
}
// 包括生产和开发的环境配置信息
module.exports = {
settings: {
enableESLint: false, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
},
webpack: {
resolve: {
// webpack的resolve配置
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.esm.js', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
alias: {
'@': resolve('src'),
$function: resolve('src/function'),
$utils: resolve('src/utils'),
},
},
createDeclaration: true, // 打包时是否创建ts声明文件
ignoreNodeModules: false, // 打包时是否忽略 node_modules
allowList: [], // ignoreNodeModules为true时生效
externals: [],
projectDir: ['src', 'demo'],
template: resolve('./demo/template.html'), // 使用自己的html模板
cssLoaderUrl: true,
moduleRules: [], // 用于配置自定义loaders
plugins: [], // 用于配置自定义plugins
},
preview: {
entry: { // 本地预览自定义组件内容
index: './demo2/preview.js',
},
// 用于开启本地调试模式的相关配置信息
NODE_ENV: 'development',
port: 80,
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
assetsSubDirectory: '',
hostname: 'localhost',
proxyTable: {
'/apiTest': {
target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
ws: true,
changeOrigin: true
}
},
cssSourceMap: true,
closeHotReload: false, // 是否关闭热更新
autoOpenBrowser: true,
},
linkDebug1: {
entry: { // 外链调试(爱速搭中预览本地自定义组件)
index: [
'./demo/react-widget/index.js',
'./demo/react-widget/plugin.jsx',
'./demo/vue-widget/index.js',
'./demo/vue-widget/plugin.jsx',
],
},
NODE_ENV: 'production',
port: 80,
autoOpenBrowser: false,
closeHtmlWebpackPlugin: true, // 关闭HtmlWebpackPlugin
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
assetsSubDirectory: '',
hostname: 'localhost',
cssSourceMap: true,
closeHotReload: true, // 是否关闭热更新
debugMode: 'aipage-editor'
},
linkDebug: { // 外链调试(使用构建后的 aipage-widget)
entry: { // 外链调试:爱速搭中预览本地自定义组件)
index: [
'./demo2/react-widget/index.js',
'./demo2/react-widget/plugin.jsx',
'./demo2/vue-widget/index.js',
'./demo2/vue-widget/plugin.jsx',
],
},
NODE_ENV: 'production',
port: 80,
autoOpenBrowser: false,
closeHtmlWebpackPlugin: true, // 关闭HtmlWebpackPlugin
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
assetsSubDirectory: '',
hostname: 'localhost',
cssSourceMap: true,
closeHotReload: true, // 是否关闭热更新
debugMode: 'aipage-editor'
},
build2lib: {
entry: {
// webpack构建入口
index: './src/main.ts', // 构建lib的入口
},
// 用于构建生产环境代码的相关配置信息
NODE_ENV: 'production', // development / production
libraryName: 'aipageWidget', // 构建第三方功能包时最后导出的引用变量名
assetsRoot: resolve('./dist'), // 打包后的文件绝对路径(物理路径)
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
assetsSubDirectory: '', // 资源引用二级路径
ignoreNodeModules: true, // 打包时是否忽略 node_modules
// allowList: ['jquery', 'vue'], // ignoreNodeModules为true时生效
productionSourceMap: false,
productionGzip: false,
productionGzipExtensions: ['js', 'css', 'json'],
bundleAnalyzerReport: false,
},
build2esm: {
input: resolve('src/main.ts'),
fileName: 'index',
// 不将以下依赖打包到输出文件中
excludeList: [
'amis',
'amis-core',
'amis-ui',
'amis-editor',
'aipage-editor',
'axios',
'jquery',
'react',
'react-dom',
'vue',
],
}
};