* ./cptable in ./node_modules/xlsx-style/dist/cpexcel.js

vue.config.js中如此这般修改


const CompressionPlugin = require("compression-webpack-plugin")
module.exports = {
    publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
    configureWebpack: () => {
        var obj = {
            externals: {
                './cptable': 'var cptable',
                '../xlsx.js': 'var _XLSX'
            }
        };
        if (process.env.NODE_ENV == "production") {
            obj.plugins = [
                new CompressionPlugin({
                    test: /\.js$|\.html$|\.css/,
                    threshold: 10240,
                    deleteOriginalAssets: false
                }),
            ];
        }
        return obj;
    },
}

参照;

https://stackoverflow.com/questions/54306961/getting-error-for-xlsx-style-after-entering-command-yarn-start

https://www.programmersought.com/article/4000147640/

https://github.com/protobi/js-xlsx/issues/78

Logo

前往低代码交流专区

更多推荐