Supporting Common JS Named Exports using ES Module Imports · Issue #3308 · google/closure-compiler (original) (raw)
Hello & good day! Since the latest release, the import { version } from './package.json
and other imports from JSON files is broken for Node.JS module resolution.
import { version } from '../package.json' console.log(version)
Version: v20190301 Built on: 2019-03-05 23:14 with
-jar node_modules/google-closure-compiler-java/compiler.jar
--compilation_level ADVANCED
--module_resolution NODE
--js t/package.js package.json
produces console.log("0.0.1-alpha");
Whereas the update has now made it not possible :(
Exit code 1
t/package.js:2: ERROR - variable null is undeclared
console.log(version)
^^^^^^^
1 error(s), 0 warning(s)
I'm now wondering if importing JSON files is actually part of Ecma6 but I don't see why it shouldn't be for at least for Node Module resolution in Closure.
If works with require
and --process_common_js_modules
btw:
const { version } = require('../package.json') console.log(version)