2017-07-07 71 views
0

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

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' 

回答

0

图书馆在NPM更名为print-js

尝试:

... 
entry: { 
    app: "./application.js", 
    vendor: ["angular", "angular-route", "scrollreveal", "clipboard", "print-js"] 
}, 
...