导出默认是忽略?空输出文件

时间:2021-08-01 17:44:10

标签: typescript webpack

我正在尝试将其与 webpack 捆绑在一起:

import { initContainer } from "./embedTypes/container";
import { initPopup } from "./embedTypes/popup";
import { initBubble } from "./embedTypes/chat";

export default {
  initContainer,
  initPopup,
  initBubble,
};

webpack.config.js

const path = require("path");

module.exports = {
  mode: "production",

  entry: "./src/index.ts",

  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "main.js",
  },

  resolve: {
    extensions: [".ts", ".js"],
  },

  module: {
    rules: [
      {
        test: /\.tsx?/,
        use: "ts-loader",
        exclude: /node_modules/,
      },
    ],
  },
};

tsconfig.json

{
  "compilerOptions": {
    "module": "ES2015",
    "target": "ES6",
    "moduleResolution": "node",
    "strict": true
  },
  "include": ["src/**/*.ts", "tests/**/*.ts"]
}

它输出一个空的 main.js 文件,我不明白为什么。这是预期的吗?

0 个答案:

没有答案