closure-loader icon indicating copy to clipboard operation
closure-loader copied to clipboard

Support for ES6 'goog:foo.bar.baz' imports

Open jdb8 opened this issue 8 years ago • 4 comments

The latest versions of google closure support es6 modules, as well as closure-specific module syntax in the form of import foo from 'goog:foo.bar.baz'. This allows for files (for example, the google closure js library itself) to continue to goog.provide('foo.bar.baz') while having their code imported into es6 modules.

Would it be simple to make this work with the loader, and correctly resolve both new- and old-style imports/requires? I've had a first attempt at modifying the loader, adding an additional regex in the form of ^import (.+) from ['"]goog:(.+)['"], but can't get things working yet: I intend to continue testing this out but thought I'd post here in the meantime in case there's any existing work on this or any roadblocks I'm overlooking.

Just to clarify, my intention would be only to transpile these special prefixed imports, and leave the pure es6 imports down to something like babel-loader since that feels more appropriate.

jdb8 avatar Apr 04 '16 16:04 jdb8