const merge = require('webpack-merge'); const tsImportPluginFactory = require('ts-import-plugin'); module.exports = { outputDir: "dist", publicPath: '/', pages: { app: { entry: './src/main.ts', template: 'public/index.html', filename: 'index.html', favicon: 'public/favicon.ico', chunks: ['app', 'chunk-vendors'], excludeChunks: ['silent-renew-oidc'] }, // silentrenewoidc: { // entry: './src/common/silent-renew.ts', // template: 'public/silent-renew.html', // filename: 'silent-renew.html', // favicon: 'public/favicon.ico', // excludeChunks: ['app'] // }, // callback: { // entry: './src/common/callback.ts', // template: 'public/callback.html', // filename: 'callback.html', // favicon: 'public/favicon.ico', // excludeChunks: ['app'] // }, }, // eslint-loader 是否在保存的时候检查 lintOnSave: true, // webpack配置 // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md chainWebpack: config => { config.module .rule('ts') .use('ts-loader') .tap(options => { options = merge(options, { transpileOnly: true, getCustomTransformers: () => ({ before: [ tsImportPluginFactory({ libraryName: 'vant', libraryDirectory: 'es', style: true }) ] }), compilerOptions: { module: 'es2015' } }); return options; }); }, configureWebpack: config => { if (process.env.NODE_ENV === "production") { // 为生产环境修改配置... config.mode = "production"; } else { // 为开发环境修改配置... config.mode = "development"; } }, // 生产环境是否生成 sourceMap 文件 productionSourceMap: true, // css相关配置 css: { // 是否使用css分离插件 ExtractTextPlugin extract: true, // 开启 CSS source maps? sourceMap: false, // css预设器配置项 loaderOptions: {}, // 启用 CSS modules for all css / pre-processor files. modules: false, //requireModuleExtension }, // use thread-loader for babel & TS in production build // enabled by default if the machine has more than 1 cores parallel: require("os").cpus().length > 1, // PWA 插件相关配置 // see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa pwa: {}, // webpack-dev-server 相关配置 devServer: { open: false,//process.platform === "darwin", host: "0.0.0.0", port: 8080, https: false, hotOnly: false, // proxy: { // "/api": { // target: "http://192.168.1.101:8080", // // target: "http://192.168.1.46:8001", // // target: "http://106.120.107.150:8001", // ws: true, // changeOrigin: true, // pathRewrite: { // "^/api": "/" // } // }, // }, // historyApiFallback: { // rewrites: [ // { from: /^\/single/, to: '/single.html' }, // ], // }, before: app => { } }, // 第三方插件配置 // pluginOptions: { // 'style-resources-loader': { // preProcessor: 'scss', // patterns: [] // } // } };