在我的webpack捆绑包中包含一个特定的非限定库文件

时间:2019-01-24 13:30:37

标签: javascript typescript webpack gulp node-modules

我正在尝试在我自己的捆绑包中包含一个非最小化的库文件。但是我不确定如何在webpack中专门配置它。

这是我的tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "esModuleInterop": true,
        "lib": ["es2015.promise", "es5", "dom"],
        "noImplicitAny": true,
        "moduleResolution": "node",
        "sourceMap": true,
        "outDir": "dist"
    }
}

我的webpack.config.js:

var createWebpackConfig = function(options) {
  return {
    mode: development,
    entry: ["babel-polyfill", "./index.ts"];
    output: {
        filename: "front-client.js",
        libraryTarget: "var",
        library: "FrontClient"
    },
    plugins: [],
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: "ts-loader",
          exclude: /node_modules/,
          include: __dirname
        }
      ]
    },
    resolve: {
      extensions: [".tsx", ".ts", ".js"]
    },
    devtool: "inline-source-map"
  };
};

我捆绑的非缩小文件包含我想要的文件的错误版本:

我的bundle.js:

...
/***/ "./node_modules/oidc-client/lib/oidc-client.min.js":
/*!*********************************************************!*\
  !*** ./node_modules/oidc-client/lib/oidc-client.min.js ***!
  \*********************************************************/

如何包含非缩小版本?像这样:

...
    /***/ "./node_modules/oidc-client/lib/oidc-client.js":
    /*!*********************************************************!*\
      !*** ./node_modules/oidc-client/lib/oidc-client.js ***!
      \*********************************************************/

0 个答案:

没有答案