Open mehulkar opened 2 years ago
In an ember app with config/targets.js exporting this:
config/targets.js
module.exports = { esmodules: true }
ember-auto-import@2 is not able to build the app. The issue seems to be that the config is passed to Webpack: https://github.com/ef4/ember-auto-import/commit/991974795f5bbd63d276094a53b273a5880013f0
ember-auto-import@2
Similarly, this config also does not work:
module.exports = { esmodules: true, browsers: [] }
because webpack then gets an empty string query for targets: (browserslist:) here:
browserslist:
https://github.com/ef4/ember-auto-import/blob/24b5eef87078cdbbcb54c6c93d0ef2e36e63eaef/packages/ember-auto-import/ts/webpack.ts#L153
I think perhaps we can use getTarget from https://babeljs.io/docs/en/babel-helper-compilation-targets to normalize the config/targets.js value into something would work here.
getTarget
In an ember app with
config/targets.js
exporting this:ember-auto-import@2
is not able to build the app. The issue seems to be that the config is passed to Webpack: https://github.com/ef4/ember-auto-import/commit/991974795f5bbd63d276094a53b273a5880013f0Similarly, this config also does not work:
because webpack then gets an empty string query for targets: (
browserslist:
) here:https://github.com/ef4/ember-auto-import/blob/24b5eef87078cdbbcb54c6c93d0ef2e36e63eaef/packages/ember-auto-import/ts/webpack.ts#L153