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

2024-08-15 14:32:23 浏览数 (3)

前言

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

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

内容

!> 实验特性

代码语言:javascript复制
const json5 = require('json5')
const miniCssExtractPlugin = require('mini-css-extract-plugin')


module.exports = {
    entry: './src/main.js',
    experiments: {
        topLevelAwait: true,
    },
}

0 人点赞