For :js-provider:require and :closure CommonJS files are processed by Closure.
Closure changed how CommonJS is rewritten by exporting everything under the .default property.
// some/file.js
exports.foo = "bar";
// used to generate
module$some$file.foo
// now it generates
module$some$file.default.foo
BUT their ES6 processing is "strict" in that you are only allowed to use the default export now.
// this is fine
import x from "some/file";
x.foo
// this is null
import { foo } from "some/file"
foo
import * as x from "some/file"
x => {default: {foo: "foo"}}
x.foo => null
Problem is that node_modules usually consists of CJS converted from ES6 by babel or webpack.
So GCC treats them as CJS but that breaks imports that otherwise work in webpack (or any other JS tool).
import { css } from "aphrodite"
// css is null
css(...)
// technically you should be using
import A from "aphrodite";
A.css(...)
Who is going to do that though if all the JS docs tell you to do the first kind of import?
For
:js-provider
:require
and:closure
CommonJS files are processed by Closure.Closure changed how CommonJS is rewritten by exporting everything under the
.default
property.BUT their ES6 processing is "strict" in that you are only allowed to use the default export now.
Problem is that
node_modules
usually consists of CJS converted from ES6 by babel or webpack.So GCC treats them as CJS but that breaks imports that otherwise work in webpack (or any other JS tool).
Who is going to do that though if all the JS docs tell you to do the first kind of import?
This is either unfinished work from https://github.com/google/closure-compiler/pull/2729#issuecomment-351199344 or working as intended.
I'm not sure how to fix this properly without just skipping Closure for CommonJS entirely.