2017-07-07 110 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"] 
}, 
...