123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- const path = require('path');
- const resolve = (dir) => path.join(__dirname, dir);
- const CopyWebpackPlugin = require('copy-webpack-plugin');
- const webpack = require('webpack');
- const cesiumSource = './node_modules/cesium/Source'
- const cesiumWorkers = '../Source/Workers'
- 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,
- configureWebpack: {
- module: {
- rules: [
- {
- test: /\.js$/,
- loader: "@open-wc/webpack-import-meta-loader"
- },
- {
- test: /\.mjs$/,
- include: /node_modules/,
- type: "javascript/auto"
- },
- ]
- }
- },
- chainWebpack: (config) => {
- config.resolve.symlinks(true);
- config.plugin('html')
- .tap(args => {
- args[0].title = "web框架";
- 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');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- devServer: {
-
- proxy: {
- '/cbk': {
- target: 'https://h5.caibeike.com.cn/',
- changeOrigin: true,
-
-
- pathRewrite: {
- '^/cbk': ''
- }
- }
- },
- open: false,
- }
- }
|