webpack - 删除“webpackBootstrap";代码 [英] webpack - remove "webpackBootstrap" code

查看:25
本文介绍了webpack - 删除“webpackBootstrap";代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WebPack 连接 js 文件并输出到 dist 文件夹.所有这些似乎都有效,但是我的问题是我想在没有额外的 webpack boostrap 代码的情况下连接所有 js 文件

I am using WebPack to concat js files and output to a dist folder. All this seems to work, however my problem is that I want to concat all the js files without extra webpack boostrap code

/******/ (function(modules) { // (/******/ (function(modules) { // webpackBootstrap)......

无论如何要防止 webpack 添加该代码,而只是获取普通的 js 文件并连接它们(如 gulp-concat).

Is there anyway to prevent webpack from adding that code rather just take the plain js files and concat them (like gulp-concat).

推荐答案

假设您使用的是 Webpack 4,将 runtimeChunk 放到配置文件中,这样 Webpack 将生成一个运行时 .js 文件,其中只包含 webpackBootstrap 部分,留下您的输出文件清理:

Assuming you are using Webpack 4, drop the runtimeChunk to the config file so Webpack will generate a runtime .js file which contains only the webpackBootstrap part, leaving your output file clean:

optimization: {
    runtimeChunk: true,
}

这篇关于webpack - 删除“webpackBootstrap";代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆