question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v4.3.1 may break ember-auto-import usage

See original GitHub issue
  • I am on the latest ember-intl version
  • I have searched the issues of this repo and believe that this is not a duplicate

Environment

  • Ember Version: 3.17.3
  • Ember CLI Version: 3.17.0
  • Ember Intl Version: 4.3.1
  • Browser(s): any modern browsers
  • Node Version: 12.16.2

NOTE: This issue is may not an actual bug, but if you encounter the same thing, this may be helpful for you.

Preconditions:

  • using ember-auto-import
  • import any module that relies on node API (not sure if this assumption is too widen)
  • upgrade older ember-intl to v4.3.1 (or v5.0.0-beta.1)

you might see a broken build with errors related to ember-auto-import, for example:

image

but it’s actually has nothing to do with ember-intl, even it happened just after you upgrade it.

The reason behind is due to this PR: https://github.com/ember-intl/ember-intl/pull/1230

The simple solution is to put this config into your own ember-cli-build.js:

const app = new EmberApp(defaults, {
  autoImport: {
    webpack: {
      node: {
        global: false, // or true, doesn't matter on this issue
      },
    },
  }
});

I’m not sure if this is a bug of ember-auto-import, or people should always set this config by themselves. A lot of users are using ember-intl (including me), it did this for us unintentionally in a long period of time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nightirecommented, Apr 17, 2020

@st-h the global option here is to refer the top-level object in Node.js environment (in browser this object is called window)

We use webpack to import 3rd-party libs, some of them use global in its source, to make them work, you have to tell webpack: please expose the global variable to those node.js compatible libs.

It’s often been required in two scenarios:

  1. Your application is running in SSR (FastBoot for example) and some libs you imported can work in both SSR and client, but they need global in SSR
  2. You import some isomorphic libs, and they are written in node.js format but transformed by tools such as browserify so that they can work in browsers as well

I use global: false in the code snippet because my situation only matches the 2nd point, I have to tell webpack to work with node.js lib but don’t have to expose the global variable.

2reactions
jasonmitcommented, Apr 17, 2020

I’ll keep this issue open for visibility for the time being.

To summarize, we were masking a bug in your app. Your app was indirectly relying on ember-intl to set an ember-auto-import config option, webpack.node.global, that you have should have been setting yourself.

ember-intl no longer needs webpack.node.global on but your app still does because some other either your app or another addon is trying to import a node module that references Node’s global object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack Returned Errors to ember-auto-import - Questions
I have a problem build error like title of my topic, anyone can help me? devDependencies: { "@ember/jquery": "^0.5. 2", "@ember/optional- ...
Read more >
Can't load module that imports css via ember-auto-import
@ckeditor/ckeditor5-image/src/image imports a CSS file. As CKEditor uses CSS-in-JS and other features not part of ECMAScript specification ...
Read more >
ember-auto-import - npm
Start using ember-auto-import in your project by running `npm i ... There are 615 other projects in the npm registry using ember-auto-import.
Read more >
Changelog - ember-bootstrap
In most cases this should not affect you, but there are some edge cases where it might break, e.g. using ember-test-selectors with the...
Read more >
yoember.com: Ember.js Octane Tutorial - From beginner to ...
//app/controllers/index.js import Controller from '@ember/controller'; ... Important note if you use Ember v3.4 or later with EmberFire.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found