const CracoLessPlugin = require('craco-less'); const path = require('path'); module.exports = { plugins: [ { plugin: CracoLessPlugin, options: { lessLoaderOptions: { lessOptions: { modifyVars: { '@primary-color': '#800080' }, javascriptEnabled: true, }, }, }, }, ], webpack: { entry: { main: ['whatwg-fetch', './src/index.js'], }, configure: (webpackConfig, { env, paths }) => { // 修改output.publicPath为'./' // webpackConfig.output.publicPath = './'; // webpackConfig.output.path = path.join(__dirname,"/build"); // webpackConfig.output.publicPath = "./"; webpackConfig.output.path = path.join(__dirname,); webpackConfig.output.publicPath = ""; // 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() return webpackConfig; }, alias: { // 将@/*映射为src目录 '@': path.resolve(__dirname, 'src/'), }, // 确保入口文件正确 // entry: { // main: ['whatwg-fetch', './src/index.js'], // }, }, devServer: { port: 3008, // 设置端口 }, };