配置如下:
const path = require('path')
/** @type {import('@craco/types').CracoConfig} */
module.exports = {
webpack: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
}配置如下:
/** @type {import('@craco/types').CracoConfig} */
module.exports = {
webpack: {
externals: {
jQuery: '$',
},
},
}配置如下:
/** @type {import('@craco/types').CracoConfig} */
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:1234',
changeOrigin: true,
pathRewrite: {
'^/api': '',
},
},
},
},
}配置如下:
/** @type {import('@craco/types').CracoConfig} */
module.exports = {
webpack: {
plugins: [
// 在 CRA 的插件之前加载,默认的行为
new Plugin(),
// 在 CRA 的插件之后加载
[new HtmlPlugin(), 'append'],
],
},
}