Coder Social home page Coder Social logo

Comments (5)

inukshuk avatar inukshuk commented on May 26, 2024 1

Switched to import assertions in 4.3.0

from edtf.js.

retorquere avatar retorquere commented on May 26, 2024 1

esbuild has so far been able to compile everything I could throw at it (with the addition of some plugins).

from edtf.js.

inukshuk avatar inukshuk commented on May 26, 2024

What prompted the change was actually that you were confused by the mixed use of CommonJS and ES modules -- we used CJS to load the locale data as a convenience because ES modules didn't support loading JSON. It looks like import assertions now work in Node.js v16 so I think we could switch to those instead.

from edtf.js.

inukshuk avatar inukshuk commented on May 26, 2024

It turns out the support in Rollup isn't great; there's a plugin, but there are complications if you (or a dependency) also requires JSON files. I'll revert back to using CommonJS for the locale data until Rollup has built-in support for import assertions.

from edtf.js.

retorquere avatar retorquere commented on May 26, 2024

This esbuild file compiles the import assertions without further plugins, and tests seem to pass:

import esbuild from 'esbuild'

esbuild.buildSync({
  entryPoints: ['index.js'],
  bundle: true,
  sourcemap: true,
  outfile: 'dist/index.cjs',
  external: [
    'assert',
    'fs',
    'nearley',
    'randexp'
  ],
  format: 'cjs',
})

from edtf.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.