| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- const merge = require("webpack-merge");
- const tsImportPluginFactory = require("ts-import-plugin");
- const version = new Date().getTime() // 全局版本号
- module.exports = {
- publicPath: process.env.VUE_APP_publicPath,
- configureWebpack: {
- devtool: process.env.devtool,
- output: {
- filename: `static/js/[name].[hash:8].js`,
- chunkFilename: `static/js/[name].[hash:8].js`
- }
- },
- css: {
- extract: {
- filename: `static/css/[name].[hash:8].css`,
- chunkFilename: `static/css/[name].[hash:8].css`
- }
- },
- chainWebpack: config => {
- config.resolve.alias.set("@assets", "@/assets");
- config.module
- .rule("ts")
- .use("ts-loader")
- .tap(options => {
- options = merge(options, {
- transpileOnly: true,
- getCustomTransformers: () => ({
- before: [
- tsImportPluginFactory({
- libraryName: "vant",
- libraryDirectory: "es",
- style: true
- })
- ]
- })
- });
- return options;
- });
- config.plugin('html').tap(args => {
- args[0].meta = [
- { 'http-equiv': 'Cache-Control', content: 'no-cache, no-store, must-revalidate' },
- { 'http-equiv': 'Pragma', content: 'no-cache' },
- { 'http-equiv': 'Expires', content: '0' }
- ];
- args.forEach(arg => {
- arg.version = version
- })
- return args
- })
- },
- devServer: {
- // port: 8080,
- disableHostCheck: true, //放过域名检查
- open: true,
- proxy: {
- '/aidesign': {
- // target: 'https://aidesign.nipponpaint.com.cn',//正式
- target: 'https://aidesigntest.nipponpaint.com.cn',//测试
- changeOrigin: true,
- secure: true
- },
- [process.env.VUE_APP_AIDESIGN_API]: {
- target: process.env.VUE_APP_AIDESIGN,
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ["^" + process.env.VUE_APP_AIDESIGN_API]: ""
- }
- },
- }
- }
- };
|