-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.ts
35 lines (32 loc) · 1.17 KB
/
craco.config.ts
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
import path from 'path';
import { name } from './package.json';
const pathResolve = (pathUrl: string) => path.join(__dirname, pathUrl);
module.exports = {
reactScriptsVersion: 'react-scripts' /* (default value) */,
webpack: {
alias: {
'@': pathResolve('src'),
'@assets': pathResolve('src/assets'),
'@components': pathResolve('src/components'),
'@utils': pathResolve('src/utils'),
},
configure(webpackConfig:any) {
// 配置扩展扩展名
webpackConfig.resolve.extensions = [...webpackConfig.resolve.extensions, ...['.scss', '.css']];
// 接入微前端框架qiankun的配置,不接入微前端可以不需要
// webpackConfig.output.library = `${name}-[name]`;
// webpackConfig.output.libraryTarget = 'umd';
// webpackConfig.output.globalObject = 'window';
return webpackConfig;
},
},
devServer: {
// 本地服务的端口号
port: 3001,
// 本地服务的响应头设置
headers: {
// 允许跨域
'Access-Control-Allow-Origin': '*',
},
},
};