123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- const path = require('path');
- const resolve = (dir) => path.join(__dirname, dir);
- const CopyWebpackPlugin = require('copy-webpack-plugin');
- const webpack = require('webpack');
- function extendDefaultPlugins(arr) {
- let plug = [
- 'removeDoctype',
- 'removeXMLProcInst',
- 'removeComments',
- 'removeMetadata',
- 'removeEditorsNSData',
- 'cleanupAttrs',
- 'mergeStyles',
- 'inlineStyles',
- 'minifyStyles',
- 'cleanupIDs',
- 'removeUselessDefs',
- 'cleanupNumericValues',
- 'convertColors',
- 'removeUnknownsAndDefaults',
- 'removeNonInheritableGroupAttrs',
- 'removeUselessStrokeAndFill',
- 'removeViewBox',
- 'cleanupEnableBackground',
- 'removeHiddenElems',
- 'removeEmptyText',
- 'convertShapeToPath',
- 'convertEllipseToCircle',
- 'moveElemsAttrsToGroup',
- 'moveGroupAttrsToElems',
- 'collapseGroups',
- 'convertPathData',
- 'convertTransform',
- 'removeEmptyAttrs',
- 'removeEmptyContainers',
- 'mergePaths',
- 'removeUnusedNS',
- 'sortDefsChildren',
- 'removeTitle',
- 'removeDesc'
- ];
- return plug.concat(arr);
- }
- function addStyleResource(rule) {
- rule.use('style-resource')
- .loader('style-resources-loader')
- .options({
- patterns: [
- resolve('src/assets/styles/common/common.less')
- ]
- })
- }
- module.exports = {
- publicPath: "./",
- indexPath: 'index.html',
- outputDir: 'dist',
- assetsDir: 'static',
- lintOnSave: false,
- runtimeCompiler: true,
- pluginOptions: {
- windicss: {
-
- },
- },
- configureWebpack: {
- plugins: [
- ],
- module:{
- rules: [
- {
- test: /\.js$/,
- use: {
- loader: '@open-wc/webpack-import-meta-loader',
- },
- },
- ]
- }
- },
- chainWebpack: (config) => {
- config.resolve.symlinks(true);
- config.plugin('html')
- .tap(args => {
- args[0].title = "新能源区域集控运行管理系统";
- return args;
- })
-
- config.resolve.alias
- .set("@", resolve("src"))
- .set("@node", resolve("node_modules"))
- .set("@com", resolve("src/components"))
- .set("@assets", resolve("src/assets"))
- .set("@api", resolve("src/api"))
- .set("@store", resolve("src/store"))
- .set("@modeConfig", resolve("public/static/config"))
- .set("@tools", resolve("src/tools"))
- .set("cesium", resolve("node_modules/cesium/Source"));
-
- const types = ['vue-modules', 'vue', 'normal-modules', 'normal'];
- types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)));
- const metaLoaderRule = config.module.rule('meta-loader');
- metaLoaderRule.test(/\.js$/)
- .use('@open-wc/webpack-import-meta-loader')
- .loader('@open-wc/webpack-import-meta-loader');
-
- config.module
- .rule('svg')
- .exclude.add(resolve('src/assets/icon/svg'))
- .end()
- .exclude.add(resolve('src/assets/icon/svg_fill'))
- .end();
-
- const svgRule = config.module.rule('icons');
- svgRule.test(/\.svg$/)
- .include.add(resolve('src/assets/icon/svg'))
- .end()
- .use('svg-sprite-loader')
- .loader('svg-sprite-loader')
- .options({
- symbolId: 'svg-[name]'
- });
-
- svgRule.use('svgo-loader').loader('svgo-loader').options({
- plugins: extendDefaultPlugins([{
- name: "removeAttrs",
- params: {
- attrs: 'fill',
- }
- }])
- });
- },
- devServer: {
-
- proxy: {
- '/cbk': {
- target: 'http://192.168.11.109:18701',
- changeOrigin: true,
-
-
- pathRewrite: {
- '^/cbk': ''
- }
- }
- },
- open: false,
- }
- }
|