2024-01-12 00:13:58 -05:00
|
|
|
const CracoLessPlugin = require('craco-less');
|
2024-03-05 23:40:37 -05:00
|
|
|
const path = require('path');
|
2024-01-12 00:13:58 -05:00
|
|
|
module.exports = {
|
|
|
|
plugins: [
|
|
|
|
{
|
|
|
|
plugin: CracoLessPlugin,
|
|
|
|
options: {
|
|
|
|
lessLoaderOptions: {
|
|
|
|
lessOptions: {
|
|
|
|
modifyVars: { '@primary-color': '#800080' },
|
|
|
|
javascriptEnabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2024-03-05 23:40:37 -05:00
|
|
|
webpack: {
|
2024-09-25 01:27:25 -04:00
|
|
|
entry: {
|
|
|
|
main: ['whatwg-fetch', './src/index.js'],
|
2024-09-24 07:07:06 -04:00
|
|
|
},
|
2024-03-05 23:40:37 -05:00
|
|
|
configure: (webpackConfig, { env, paths }) => {
|
|
|
|
// 修改output.publicPath为'./'
|
|
|
|
// webpackConfig.output.publicPath = './';
|
2024-09-25 01:27:25 -04:00
|
|
|
// webpackConfig.output.path = path.join(__dirname,"/build");
|
|
|
|
// webpackConfig.output.publicPath = "./";
|
|
|
|
|
2024-09-24 06:53:53 -04:00
|
|
|
webpackConfig.output.path = path.join(__dirname,);
|
|
|
|
webpackConfig.output.publicPath = "";
|
2024-09-25 01:27:25 -04:00
|
|
|
// webpackConfig.output.module
|
|
|
|
// .rule("icons")
|
|
|
|
// .test(/\.svg$/)
|
|
|
|
// .include.add(resolve("src/icons"))
|
|
|
|
// .end()
|
|
|
|
// .use("svg-sprite-loader")
|
|
|
|
// .loader("svg-sprite-loader")
|
|
|
|
// .options({
|
|
|
|
// symbolId: "icon-[name]",
|
|
|
|
// })
|
|
|
|
// .end()
|
2024-03-05 23:40:37 -05:00
|
|
|
return webpackConfig;
|
|
|
|
},
|
2024-09-25 01:27:25 -04:00
|
|
|
alias: {
|
|
|
|
// 将@/*映射为src目录
|
|
|
|
'@': path.resolve(__dirname, 'src/'),
|
|
|
|
},
|
|
|
|
// 确保入口文件正确
|
|
|
|
// entry: {
|
|
|
|
// main: ['whatwg-fetch', './src/index.js'],
|
|
|
|
// },
|
2024-09-24 06:53:53 -04:00
|
|
|
},
|
|
|
|
devServer: {
|
2024-09-25 01:27:25 -04:00
|
|
|
port: 3008, // 设置端口
|
2024-09-24 06:53:53 -04:00
|
|
|
},
|
2024-03-05 23:40:37 -05:00
|
|
|
};
|