[Pkg-javascript-devel] Bug#970550: replacing browserify with webpack or rollup - need help

Pirate Praveen praveen at onenetbeyond.org
Sun Sep 20 10:44:36 BST 2020


Control: tags -1 help

On Sun, Sep 20, 2020 at 14:44, Pirate Praveen 
<praveen at onenetbeyond.org> wrote:
> The warning now changes to,
> 
> (!) Missing shims for Node.js built-ins
> Creating a browser bundle that depends on 'path', 'url' and 'os'. You 
> might need to include 
> https://www.npmjs.com/package/rollup-plugin-node-builtins
> (!) Unresolved dependencies
> https://rollupjs.org/guide/en#warning-treating-module-as-external-dependency
> path (imported by ../../../usr/share/nodejs/browserslist/index.js, 
> commonjs-external:path, 
> ../../../usr/share/nodejs/postcss/lib/input.js, 
> ../../../usr/share/nodejs/browserslist/node.js, 
> ../../../usr/share/nodejs/postcss/lib/map-generator.js, 
> ../../../usr/share/nodejs/postcss/lib/previous-map.js)

rollup-plugin-node-builtins is not packaged in debian. So I decided to 
try webpack (code pushed to a separate branch 'webpack'),

This has resulted in a situation where we need to handle Buffer 
correctyly.

with Buffer: true in webpack.config.js, the build fails with error

ERROR in /usr/share/nodejs/postcss/lib/map-generator.js
Module not found: Error: Can't resolve 
'./../../../../../<<PKGBUILDDIR>>/buffer' in 
'/usr/share/nodejs/postcss/lib'
 @ /usr/share/nodejs/postcss/lib/map-generator.js 1:0-89
 @ /usr/share/nodejs/postcss/lib/lazy-result.js
 @ /usr/share/nodejs/postcss/lib/processor.js
 @ /usr/share/nodejs/postcss/lib/postcss.js
 @ ./lib/autoprefixer.js

with Buffer: "mock" or Buffer: false, the build passes, but now rake 
assets:precompile in diaspora fails with the following error

root at diaspora-buster-main:/usr/share/diaspora# sudo -u diaspora -E -H 
bundle exec rake assets:precompile
rake aborted!
ExecJS::RuntimeError: /tmp/execjs20200920-897-qyh1s1js:87
    process.stdout.write('' + string);
                   ^

TypeError: Cannot read property 'write' of undefined
    at print (/tmp/execjs20200920-897-qyh1s1js:87:20)
    at /tmp/execjs20200920-897-qyh1s1js:101:5
    at /tmp/execjs20200920-897-qyh1s1js:1:40
    at Object.<anonymous> (/tmp/execjs20200920-897-qyh1s1js:1:58)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js 
(internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
/usr/share/diaspora/app/assets/config/manifest.js:9
(execjs):87
/usr/share/rubygems-integration/all/gems/autoprefixer-rails-8.6.5/lib/autoprefixer-rails/processor.rb:153:in 
`runtime'
/usr/share/rubygems-integration/all/gems/autoprefixer-rails-8.6.5/lib/autoprefixer-rails/processor.rb:37:in 
`process'
/usr/share/rubygems-integration/all/gems/autoprefixer-rails-8.6.5/lib/autoprefixer-rails/sprockets.rb:20:in 
`run'
/usr/share/rubygems-integration/all/gems/autoprefixer-rails-8.6.5/lib/autoprefixer-rails/sprockets.rb:14:in 
`call'
/usr/share/rubygems-integration/all/gems/rake-13.0.1/exe/rake:27:in 
`<top (required)>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
root at diaspora-buster-main:/usr/share/diaspora#

libraryTarget="window", libraryTrget="umd" was also tried without 
success.

Packaging rollup-plugin-node-builtins may be one option. Any ideas?



More information about the Pkg-javascript-devel mailing list