0

我正在尝试使用 webpack 将print.js库导入到我的项目中的供应商包中。由于某种原因,它无法解析模块。print.js node_modules 文件夹包含一些有趣的文件——webpack.mix.js它们src/index.js似乎是用 ES6 编写的。也许我缺少依赖或 ES6 支持?

我的webpack.config.js

var webpack = require("webpack"),
    path = require("path");

const Dotenv = require('dotenv-webpack');

module.exports = {

 context: __dirname + "/public",
  entry: {
    app: "./application.js",
    vendor: ["angular", "angular-route", "scrollreveal", "clipboard", "print.js"]  
  },
  output: {
    path: __dirname + "/public/scripts",
    filename: "trails.bundle.js"
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({name: "vendor", filename: "vendor.bundle.js"}),
    new Dotenv({
      path: './.env', // Path to .env file (this is the default)
    })
  ]
};

错误:

ERROR in multi angular angular-route scrollreveal clipboard print.js
Module not found: Error: Can't resolve 'print.js'
4

1 回答 1

1

该库print-js在 npm 中重命名为。

尝试:

...
entry: {
  app: "./application.js",
  vendor: ["angular", "angular-route", "scrollreveal", "clipboard", "print-js"]  
},
...
于 2018-03-04T22:31:21.197 回答