forked from xuRookie/react-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcraco.config.js
More file actions
executable file
·49 lines (47 loc) · 1.39 KB
/
craco.config.js
File metadata and controls
executable file
·49 lines (47 loc) · 1.39 KB
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
// const CracoLessPlugin = require('craco-less')
const path = require('path')
const resolve = pathUrl => path.join(__dirname, pathUrl)
module.exports = {
webpack: {
alias: {
'@': resolve('src'),
'@assets': resolve('src/assets')
},
/**
* 重写 webpack 任意配置
* - configure 能够重写 webpack 相关的所有配置,但是,仍然推荐你优先阅读 craco 提供的快捷配置,把解决不了的配置放到 configure 里解决;
* - 这里选择配置为函数,与直接定义 configure 对象方式互斥;
*/
configure: (webpackConfig, {
env, paths
}) => {
// paths.appPath='public'
paths.appBuild = 'build'
webpackConfig.output = {
...webpackConfig.output,
// ...{
// filename: whenDev(() => 'static/js/bundle.js', 'static/js/[name].js'),
// chunkFilename: 'static/js/[name].js'
// },
path: path.resolve(__dirname, 'build'), // 修改输出文件目录
publicPath: './'
}
return webpackConfig
}
},
devServer: {
port: 3002,
hot: true
},
// plugins: [
// {
// plugin: CracoLessPlugin,
// options: {
// lessLoaderOptions: {
// // modifyVars: { '@primary-color': '#1da57a' },
// javascriptEnabled: true
// }
// }
// }
// ]
}