1
我正在嘗試將rollup.js合併到項目中。目前,我正在在控制檯(未解決的依賴)下面提供的警告,我不知道爲什麼或如何解決它:Rollup.js未解決的依賴項
'fs' is imported by node_modules\filereader\FileReader.js, but could not be resolved – treating it as an external dependency
'fs' is imported by commonjs-external:fs, but could not be resolved – treating it as an external dependency
preferring built-in module 'punycode' over local alternative at 'C:\Users\Ryan\OneDrive\Projects\Custom Coding\Zapier\Ryan Test\node_modules\punycode\punycode.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
preferring built-in module 'punycode' over local alternative at 'C:\Users\Ryan\OneDrive\Projects\Custom Coding\Zapier\Ryan Test\node_modules\punycode\punycode.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
這裏是test.js腳本需要的FileReader和https:
var FileReader = require('filereader');
var https = require('https');
最後rollup.config.js文件,該文件執行創建包:
var rollup = require('rollup');
var commonjs = require('rollup-plugin-commonjs');
var nodeResolve = require('rollup-plugin-node-resolve');
var globals = require('rollup-plugin-node-globals');
var builtins = require('rollup-plugin-node-builtins');
// build bundle
rollup
.rollup({
entry: 'test.js',
plugins: [
nodeResolve(),
commonjs(),
globals(),
builtins()
]
})
.then(bundle => bundle.write({
dest: 'rollupBundle/bundle.js',
format: 'cjs'
}))
.catch(err => console.log(err.stack));
感謝豐富,我認爲這會工作。 –
任何想法,爲什麼我會得到一個錯誤,說https沒有基於上述定義?這不是彙總錯誤,而是來自我試圖部署的環境的錯誤。 –
很難說沒有repro來調查,對不起 –