source code
// index.js
export function test() {
}
webpack.config.js
const HtmlPlugin = require("html-webpack-plugin");
/**@type {import('webpack').Configuration} */
module.exports = {
mode: "production",
entry: { a: "./a/index.js" },
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js", ".mjs"],
// Add support for TypeScripts fully qualified ESM imports.
extensionAlias: {
".js": [".js", ".ts"],
".cjs": [".cjs", ".cts"],
".mjs": [".mjs", ".mts"],
},
},
target: ["web", "es5"],
output: {
publicPath: "/",
},
plugins: [
],
optimization: {
innerGraph: false,
usedExports:'global',
minimize: false,
mangleExports: false,
concatenateModules: false,
providedExports: true,
sideEffects: true,
moduleIds: "named",
removeAvailableModules: false
}
devtool: false,
};
result
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
/* unused harmony export test */
function test() {
}
/******/ })()
;