emberjs / ember-cli-babel

Ember CLI plugin for Babel
MIT License
153 stars 119 forks source link

Specifying Babel options results in 'import' in the middle of bundle #395

Open maxhq opened 3 years ago

maxhq commented 3 years ago

Error:

Build Error (TerserWriter)

"Import" statement may only appear at the top level

Stack Trace and Error Report: /tmp/error.dump.212d6b5aecc3b277dd35bac22e8187ec.log

Steps to reproduce:

npm install -g ember-cli
ember new testapp --lang en
cd testapp/

ember install ember-cli-babel

cat <<'EOF' > ember-cli-build.js
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
  let app = new EmberApp(defaults, {
    'babel': {
      useBuiltIns: 'usage',
      corejs: {
        version: '2.6.12',
      },
    },
  });
  return app.toTree();
};
EOF

npm run build