Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
Using node.js experimental loaders with rollup

I am using rollup to bundle my Node.js applications - it allows me to deploy them in production as a single file without relying on npm.

I also happen to have my own custom loaders for some special format files that I import in my code by calling

node --experimental-loader=./lib/txt-colormap-es-loader.mjs and then doing

import colormap from './colormaps/01.txt';

One of these is handlebars for which there is a special plugin in rollup.

But I also have my own custom formats with my own custom loaders.

Does anyone see any way I could make rollup work with my custom ES6 loader in Node.js short of writing a new plugin?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found a suboptimal solution without developing/publishing/maintaining a new rollup plugin - import the loader itself and call it manually on the file imported as a string. Importing as a string can be accomplished

  • In development, before bundling, by

    https://www.npmjs.com/package/import-as-string

  • In production, with rollup, by

    https://www.npmjs.com/package/rollup-plugin-string

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!