webpack——The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)

前言

在搏皮中通过动态的引入CDN资源,来减少搏皮制品的大小,但是webpack没有开启topLevelAwait所以产生了报错;

experiments: https://webpack.docschina.org/configuration/experiments/

内容

!> 实验特性

const json5 = require('json5')
const miniCssExtractPlugin = require('mini-css-extract-plugin')


module.exports = {
    entry: './src/main.js',
    experiments: {
        topLevelAwait: true,
    },
}
posted @ 2022-12-15 02:04  。思索  阅读(1458)  评论(0)    收藏  举报