Webpack 安装网页包和vue3

Webpack 安装网页包和vue3,webpack,vuejs3,Webpack,Vuejs3,我正在尝试用webpack和typescript设置vue3。 目前我遇到的问题是,每当我尝试运行webpack service,浏览器控制台中都会出现警告: runtime-core.esm-bundler.js:3413 You are running the esm-bundler build of Vue. It is recommended to configure your bundler to explicitly replace feature flag globals with

我正在尝试用webpack和typescript设置vue3。 目前我遇到的问题是,每当我尝试运行
webpack service
,浏览器控制台中都会出现警告:

runtime-core.esm-bundler.js:3413 You are running the esm-bundler build of Vue. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle. See http://link.vuejs.org/feature-flags for more details.
我不明白。我的网页配置如下:

const path = require("path")

module.exports = {
    mode: 'development',
    entry: './src/index.ts',
    devtool: 'inline-source-map',
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/,
            },
        ],
    },
    resolve: {
        alias: {
            vue: "vue/dist/vue.esm-bundler.js"
        },
        extensions: ['.tsx', '.ts', '.js'],
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
}
这是tsconfig:

{
    "compilerOptions": {
        "outDir": "./dist/",
        "noImplicitAny": true,
        "module": "es6",
        "target": "es5",
        "allowJs": true,
        "moduleResolution": "node"
    }
}

我希望有一个没有这个警告的配置,然后继续支持证监会

从错误中获得的链接

构建将在不配置这些标志的情况下工作,但是强烈建议正确配置它们,以便在最终捆绑包中获得适当的树抖动

这会解决你的问题

const path=require(“路径”);
const webpack=require('webpack');
module.exports={
模式:"发展",,
条目:'./src/index.ts',
devtool:“内联源映射”,
模块:{
规则:[
{
测试:/\.tsx?$/,,
使用“ts加载器”,
排除:/node_模块/,
},
],
},
决心:{
别名:{
vue:“vue/dist/vue.esm bundler.js”
},
扩展名:['.tsx','.ts','.js'],
},
输出:{
文件名:“bundle.js”,
path:path.resolve(uu dirname,'dist'),
},
插件:[
新的webpack.DefinePlugin({
“_VUE_OPTIONS_API__;”:正确,
“产品开发工具”:错误,
});
],
}
还值得添加,这是vue项目的标准工具。

请检查