12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- const { defineConfig } = require("@vue/cli-service");
- const linariaLessLoader = require("@queenjs/webpack-loader/linaria-loader");
- const modifyVars = require("./src/styles/theme-antd");
- const path = require("path");
- const publicPath =
- process.env.NODE_ENV === "production"
- ? `//infishwaibao.oss-cn-chengdu.aliyuncs.com/queenstat/`
- : "./";
- // const publicPath = "./";
- module.exports = defineConfig({
- pages: {
- index: "src/pages/website/index.ts",
- h5: "src/pages/h5/index.ts",
- },
- publicPath: publicPath,
- devServer: {
- client: {
- overlay: {
- errors: true,
- warnings: false,
- runtimeErrors: false,
- },
- },
- },
- chainWebpack: (config) => {
- const tsRule = config.module.rule("ts");
- tsRule
- .use("moduse-loader")
- .loader("moduse/webpack-loader")
- .options({
- include: [
- path.resolve(__dirname, "./src/modules"),
- path.resolve(__dirname, "./node_modules/@queenjs-modules"),
- ],
- });
- const tsxRule = config.module.rule("tsx");
- tsxRule.uses.store.delete("thread-loader");
- tsxRule
- .use("@linaria/webpack-loader")
- .loader("@linaria/webpack-loader")
- .options({
- // 将.css文件更名为.less
- extension: ".linaria.less",
- preprocessor: linariaLessLoader("@/styles/theme"),
- })
- .before("ts-loader");
- },
- css: {
- loaderOptions: {
- less: {
- lessOptions: {
- modifyVars,
- javascriptEnabled: true,
- },
- },
- },
- },
- pluginOptions: {
- windicss: {
- scan: {
- dirs: ["node_modules/@queenjs-modules"],
- fileExtensions: ["tsx"],
- },
- preflight: false,
- onOptionsResolved: (options) => {
- // make sure file @apply's get transformed
- options.scanOptions.extraTransformTargets = {
- css: [
- (f) => {
- if (/node_modules\\@queenjs-modules\\.+\.(css|less)/.test(f)) {
- return true;
- }
- return false;
- },
- ],
- detect: [],
- };
- return options;
- },
- },
- },
- });
|