1

I've been playing around with using es6 modules directly, without using Webpack, rollup, etc. After reading this article, I settled on the following:

import { MyObject } from './node_modules/module_name/index.mjs'

This works fairly well (in both browsers, and node using the esm module and running with node -r esm), but falls apart if you have nested dependencies. For example, if you have two modules that both depend on the same version of a third module, npm will only install a single copy of the third module at the top level, so when the first two modules go looking for it in ./node_modules it doesn't exist.

As far as I know there's not currently away around this other than bundling. Is there any plan for a unified syntax?

anderspitman
  • 9,230
  • 10
  • 40
  • 61

0 Answers0