Giter Site home page Giter Site logo

ember-auto-import's Introduction

ember-auto-import

Just import from NPM, with zero configuration.

Installation

npm install --save-dev ember-auto-import webpack

If you're upgrading from 1.x to 2.x see the upgrade guide.

Usage

Add whatever dependency you want to your project using NPM or yarn like:

npm install --save-dev lodash-es

or

yarn add --dev lodash-es

Then just import it from your Ember app code:

import { capitalize } from 'lodash-es';

There is no step two. Works from both app code and test code.

Dynamic Import

In addition to static top-level import statements, you can use dynamic import() to lazily load your dependencies. This can be great for reducing your initial bundle size.

Dynamic import is currently a Stage 3 ECMA feature, so to use it there are a few extra setup steps:

  1. npm install --save-dev babel-eslint

  2. In your .eslintrc.js file, add

    parser: 'babel-eslint'
    
  3. In your ember-cli-build.js file, enable the babel plugin provided by ember-auto-import:

let app = new EmberApp(defaults, {
  babel: {
    plugins: [require.resolve('ember-auto-import/babel-plugin')],
  },
});

Once you're setup, you can use dynamic import() and it will result in loading that particular dependency (and all its recursive dependencies) via a separate Javascript file at runtime. Here's an example of using dynamic import from within a Route, so that the extra library needed for the route is loaded at the same time the data is loaded:

export default Route.extend({
  model({ id }) {
    return Promise.all([
      fetch(`/data-for-chart/${id}`).then(response => response.json()),
      import('highcharts').then(module => module.default),
    ]).then(([dataPoints, highcharts]) => {
      return { dataPoints, highcharts };
    });
  },
});

If you're using custom deployment code, make sure it will include all the Javascript files in dist/assets, not just the default app.js and vendor.js.

App imports

ember-auto-import was originally designed to allow Ember apps to import from npm packages easily, and would have no influence on your app's files (i.e. files that exist in your app folder). This meant that every time you had an import like import someBigLib from 'my-app-name/lib/massive' there was no way for you to:

  • use webpack plugins to influence the loading of my-app-name/lib/massive
  • dynamically import my-app-name/lib/massive in such a way that it wouldn't increase the size of your asset.
  • import assets from your app that would go through webpack loaders

Fortunatly there is a way to configure ember-auto-import to work on certain parts of your app using the allowAppImports configuration option. If you set the option to:

let app = new EmberApp(defaults, {
  autoImport: {
    allowAppImports: [ 'lib/*' ],
  }
});

Then the my-app-name/lib/massive file (and all other files in lib) would now be handled by ember-auto-import. This would then allow you to dynamically import('my-app-name/lib/massive') which means that you can dynamically load parts of your app on demand without first splitting them into an addon or an npm package.

Customizing Build Behavior

While most NPM packages authored in CommonJS or ES Modules will Just Work, for others you may need to give ember-auto-import a hint about what to do.

You can set options like this in your ember-cli-build.js:

// In your ember-cli-build.js file
let app = new EmberApp(defaults, {
  autoImport: {
    alias: {
      // when the app tries to import from "plotly.js", use
      // the real package "plotly.js-basic-dist" instead.
      'plotly.js': 'plotly.js-basic-dist',

      // you can also use aliases to pick a different entrypoint
      // within the same package. This can come up when the default
      // entrypoint only works in Node, but there is also a browser
      // build available (and the author didn't provide a "browser"
      // field in package.json that would let us detect it
      // automatically).
      handlebars: 'handlebars/dist/handlebars',

      // We do a prefix match by default, so the above would also
      // convert "handlebars/foo" to "handlebars/dist/handlesbars/foo".
      // If instad you want an exact match only, you can use a trailing "$".
      // For example, this will rewrite "some-package/alpha" to "customized"
      // but leave "some-package/beta" alone.
      'some-package/alpha$': 'customized',
    },
    allowAppImports: [
      // minimatch patterns for app files that you want to be handled by ember-auto-import
    ],
    exclude: ['some-package'],
    skipBabel: [
      {
        // when an already-babel-transpiled package like "mapbox-gl" is
        // not skipped, it can produce errors in the production mode
        // due to double transpilation
        package: 'mapbox-gl',
        semverRange: '*',
      },
    ],
    watchDependencies: [
      // trigger rebuilds if "some-lib" changes during development
      'some-lib',
      // trigger rebuilds if "some-lib"'s inner dependency "other-lib" changes
      ['some-lib', 'other-lib'],
    ],
    webpack: {
      // extra webpack configuration goes here
    },
  },
});

Supported Options

  • alias: object, Map from imported names to substitute names that will be imported instead. This is a prefix match by default. To opt out of prefix-matching and only match exactly, add a $ suffix to the pattern.
  • allowAppImports: list of strings, defaults to []. Files in your app folder that match these minimatch patterns will be handled by ember-auto-import (and thus Webpack) and no longer be part of the regular ember-cli pipeline.
  • exclude: list of strings, defaults to []. Packages in this list will be ignored by ember-auto-import. Can be helpful if the package is already included another way (like a shim from some other Ember addon).
  • forbidEval: boolean, defaults to false. We use eval in development by default (because that is the fastest way to provide sourcemaps). If you need to comply with a strict Content Security Policy (CSP), you can set forbidEval: true. You will still get sourcemaps, they will just use a slower implementation.
  • insertScriptsAt: string, defaults to undefined. Optionally allows you to take manual control over where ember-auto-import's generated <script> tags will be inserted into your HTML and what attributes they will have. See "Customizing HTML Insertion" below.
  • insertStylesAt: string, defaults to undefined. Optionally allows you to take manual control over where ember-auto-import's generated <link rel="stylesheet"> tags (if any) will be inserted into your HTML and what attributes they will have. See "Customizing HTML Insertion" below.
  • publicAssetURL: the public URL to your /assets directory on the web. Many apps won't need to set this because we try to detect it automatically, but you will need to set this explicitly if you're deploying your assets to a different origin than your app (for example, on a CDN) or if you are using <script defer> (which causes scripts to be unable to guess what origin they loaded from).
  • skipBabel: list of objects, defaults to []. The specified packages will be skipped from babel transpilation.
  • watchDependencies: list of strings or string arrays, defaults to []. Tells ember-auto-import that you'd like to trigger a rebuild if one of these auto-imported dependencies changes. Pass a package name that refers to one of your own dependencies, or pass an array of package names to address a deeper dependency.
  • webpack: object, An object that will get merged into the configuration we pass to webpack. This lets you work around quirks in underlying libraries and otherwise customize the way Webpack will assemble your dependencies.

Usage from Addons

Using ember-auto-import inside an addon is almost exactly the same as inside an app.

Installing ember-auto-import in an addon

To add ember-auto-import to your addon:

  • add ember-auto-import to your dependencies, not your devDependencies, so it will be present when your addon is used by apps

  • add webpack to your devDependencies (to support your test suite) but not your dependencies (the app's version will be used)

  • document for your users that their app must depend on ember-auto-import >= 2 in order to use your addon

  • configure ember-auto-import (if needed) in your index.js file (not your ember-cli-build.js file), like this:

    // In your addon's index.js file
    module.exports = {
      name: 'sample-addon',
      options: {
        autoImport: {
          exclude: ['some-package'],
        },
      },
    };
  • if your addon uses Dynamic Import, it is required that you register the babel plugin in your index.js instead of ember-cli-build.js:

    // index.js
    module.exports = {
      options: {
        babel: {
          plugins: [require.resolve('ember-auto-import/babel-plugin')],
        },
      },
    };

Caveats in addons

  • ember-auto-import will refuse to import devDependencies of your addon into addon code (because that would fail in a consuming application). You can import devDependencies into your test suite & dummy app.
  • ember-auto-import will not detect import statements inside your app folder. This is because the files inside app are conceptually not part of your addon's own package namespace at all, so they don't get access to your addon's dependencies. Do all your auto-importing from the addon folder, and reexport in app as needed.
  • while addons are allowed to pass the autoImport.webpack option to add things to the webpack config, this makes them less likely to be broadly compatible with apps using different webpack versions. If you need to rely on a specific webpack feature, you should document which versions of webpack you support.

Customizing HTML Insertion

ember-auto-import uses webpack to generate one or more chunk files containing all your auto-imported dependencies, and then ember-auto-import inserts <script> tags to your HTML to make sure those chunks are included into your app (and tests, as appropriate). By default, the "app" webpack chunk(s) will be inserted after Ember's traditional "vendor.js" and the "tests" webpack chunk(s) will be inserted after "test-support.js".

If you need more control over the HTML insertion, you can use the insertScriptsAt option (or the insertStylesAt option, which is exactly analogous but for standalone CSS instead of JS). To customize HTML insertion:

  1. Set insertScriptsAt to a custom element name. You get to pick the name so that it can't collide with any existing custom elements in your site, but a good default choice is "auto-import-script":

    let app = new EmberApp(defaults, {
      autoImport: {
        insertScriptsAt: 'auto-import-script',
      },
    });
  2. In your index.html and tests/index.html, use the custom element to designate exactly where you want the "app" and "tests" entrypoints to be inserted:

     <!-- in index.html -->
     <body>
       {{content-for "body"}}
       <script src="{{rootURL}}assets/vendor.js"></script>
    +   <auto-import-script entrypoint="app"></auto-import-script>
       <script src="{{rootURL}}assets/your-app.js"></script>
       {{content-for "body-footer"}}
     </body>
     <!-- in tests/index.html -->
     <body>
       {{content-for "body"}}
       {{content-for "test-body"}}
    
       <div id="qunit"></div>
       <div id="qunit-fixture">
         <div id="ember-testing-container">
           <div id="ember-testing"></div>
         </div>
       </div>
    
       <script src="/testem.js" integrity=""></script>
       <script src="{{rootURL}}assets/vendor.js"></script>
    +   <auto-import-script entrypoint="app"></auto-import-script>
       <script src="{{rootURL}}assets/test-support.js"></script>
    +   <auto-import-script entrypoint="tests"></auto-import-script>
       <script src="{{rootURL}}assets/your-app.js"></script>
       <script src="{{rootURL}}assets/tests.js"></script>
    
       {{content-for "body-footer"}}
       {{content-for "test-body-footer"}}
     </body>
  3. Any attributes other than entrypoint will be copied onto the resulting <script> tags inserted by ember-auto-import. For example, if you want <script defer></script> you can say:

    <auto-import-script defer entrypoint="app"> </auto-import-script>

    And this will result in output like:

    <script defer src="/assets/chunk-12341234.js"></script>

Once you enable insertScriptsAt you must designate places for the "app" and "tests" entrypoints if you want ember-auto-import to work correctly. You may also optionally designate additional entrypoints and manually add them to the webpack config. For example, you might want to build a polyfills bundle that needs to run before vendor.js on pre-ES-module browsers:

// ember-cli-build.js
let app = new EmberApp(defaults, {
  autoImport: {
    insertScriptsAt: 'auto-import-script',
    webpack: {
      entry: {
        polyfills: './lib/polyfills.js',
      },
    },
  },
});

// lib/polyfills.js
import 'core-js/stable';
import 'intl';
<!-- index.html -->
<auto-import-script nomodule entrypoint="polyfills"></auto-import-script>
<script src="{{rootURL}}assets/vendor.js"></script>
<auto-import-script entrypoint="app"></auto-import-script>
<script src="{{rootURL}}assets/your-app.js"></script>

Fastboot

ember-auto-import works with Fastboot to support server-side rendering.

When using Fastboot, you may need to add your Node version to config/targets.js in order to only use Javascript features that work in that Node version. When you do this, it may prevent webpack from being able to infer that it should still be doing a build that targets the web. This may result in an error message like:

For the selected environment is no default script chunk format available:
JSONP Array push can be chosen when 'document' or 'importScripts' is available.
CommonJs exports can be chosen when 'require' or node builtins are available.
Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly.

You can fix this by setting the target to web explicitly:

// ember-cli-build.js
let app = new EmberApp(defaults, {
  autoImport: {
    webpack: {
      target: 'web',
    },
  },
});

FAQ

global is undefined or can't find module "path" or can't find module "fs"

You're trying to use a library that is written to work in NodeJS and not in the browser. You can choose to polyfill the Node feature you need by passing settings to webpack. For example:

let app = new EmberApp(defaults, {
  autoImport: {
    webpack: {
      node: {
        global: true,
        fs: 'empty'
      }
    }
  }

See webpack's docs on Node polyfills.

I use Content Security Policy (CSP) and it breaks ember-auto-import.

See forbidEval above.

I'm trying to load a jQuery plugin, but it doesn't attach itself to the copy of jQuery that's already in my Ember app.

Ember apps typically get jQuery from the ember-source or @ember/jquery packages. Neither of these is the real jquery NPM package, so ember-auto-import cannot "see" it statically at build time. You will need to give webpack a hint to treat jQuery as external:

// In your ember-cli-build.js file
let app = new EmberApp(defaults, {
  autoImport: {
    webpack: {
      externals: { jquery: 'jQuery' },
    },
  },
});

Also, some jQuery plugins like masonry and flickity have required manual steps to connect them to jQuery.

I upgraded my ember-auto-import version and now things don't import. What changed?

As of version 1.4.0, by default, ember-auto-import does not include webpack's automatic polyfills for certain Node packages. Some signs that your app was depending on these polyfills by accident are things like "global is not defined," "can't resolve path," or "default is not a function." You can opt-in to Webpack's polyfills, or install your own. See this issue for an example.

I get Uncaught ReferenceError: a is not defined 251 with an already babel transpiled addon, e.g: mapbox-gl

We should skip that specific addon from the ember-auto-import's babel transpilation as:

// In your app's ember-cli-build.js file or check the `Usage from Addons` section for relevant usage of the following in addons
let app = new EmberApp(defaults, {
  autoImport: {
    skipBabel: [
      {
        package: 'mapbox-gl',
        semverRange: '*',
      },
    ],
  },
});

I want to import a module for side effects only.

Some modules, often times polyfills, don't provide values meant for direct import. Instead, the module is meant to provide certain side affects, such as mutating global variables.

To import a module for side affects only, you can simply import the module directly.
Any side affects the module provides will take affect.

Example: the eventsource package provides a ready to use eventsource-polyfill.js module.

This can be imported like:

// In any js file, likely the file you need to access the polyfill, purely for organization.

// Importing the polyfill adds a new global object EventSourcePolyfill.
import 'eventsource/example/eventsource-polyfill.js';

Debugging Tips

Set the environment variable DEBUG="ember-auto-import:*" to see debug logging during the build.

To see Webpack's console output, set the environment variable AUTO_IMPORT_VERBOSE=true.

Credit / History

Takes inspiration and some code from ember-browserify and ember-cli-cjs-transform. This package is basically what you get when you combine the ideas from those two addons.

Contributing

See CONTRIBUTING.md

License

This project is licensed under the MIT License.

ember-auto-import's People

Contributors

boris-petrov avatar buschtoens avatar candunaj avatar ctjhoa avatar dependabot[bot] avatar ef4 avatar gabrielcsapo avatar hjdivad avatar jamescdavis avatar jelhan avatar jrjohnson avatar kasunvp avatar keithzmudzinski avatar kiwi-josh avatar mansona avatar mattmcmanus avatar maxfierke avatar mrchocolatine avatar ndekeister-us avatar nlfurniss avatar nullvoxpopuli avatar paddyobrien avatar rwjblue avatar sergeastapov avatar simonihmig avatar stefanpenner avatar timmorey avatar tmquinn avatar turbo87 avatar vstefanovic97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-auto-import's Issues

Ability to build from dependency's src directory

Libraries that primarily target ecosystems other than Ember, usually transpile their ES builds to target the browsers they support. For example, if the library supports IE11 the modules build will transpile classes.

The problem arises when babel transpiled class tries to extend a native class, it throws this error: Class constructor User cannot be invoked without 'new'.

Since EmberCLI knows the browser requirements for each app, we can skip the bundled modules by going directly to the src directory. It won't be the right solution for all modules but it will for some like microstates.

Is it possible for me to configure ember-microstates to tell ember-auto-import to build from src directory that's included in the npm package?

Support for lazy engines

It seems that ember-engines is currently not supported by this project, but it would be great if lazy engines could also take advantage of the automatic bundling.

Better broccoli caching

We should use the same caching architecture that ember-cli-cjs-transform uses to avoid re-running rollup on rebuilds.

`mainFields` not configurable through `webpack.resolve.mainFields`

The resolver that ember-auto-importer uses to build up stats of all the entrypoints does not take into account user provided options passed via webpack.{mainFields,extensions}.

https://github.com/ef4/ember-auto-import/blob/master/ts/splitter.ts#L17-L18

This is causing graphql-js to always resolve to main over module when in my case I need to flip the priority. Are you open to this being configurable via the webpack options?

Related: ember-graphql/ember-apollo-client#145

Cannot make ember-auto-import work at all

I tried following the Usage step in the README but it doesn't seem to work in our project:

Uncaught Error: Could not find module `lodash-es` imported from `frontend/app`

And I've done just the couple of steps in the example. I tried also a bunch of other things but no luck. We have a big ember-cli-build.js file (like 230 lines of code) and I did try removing most of the things inside and still it doesn't do anything. (Part of) the debug output:

  ...
  ember-auto-import:analyzer     "specifier": "../config/environment",
  ember-auto-import:analyzer     "path": "frontend/tests/test-helper.js",
  ember-auto-import:analyzer     "isDynamic": false,
  ember-auto-import:analyzer     "package": "frontend"
  ember-auto-import:analyzer   },
  ember-auto-import:analyzer   {
  ember-auto-import:analyzer     "specifier": "@ember/test-helpers",
  ember-auto-import:analyzer     "path": "frontend/tests/test-helper.js",
  ember-auto-import:analyzer     "isDynamic": false,
  ember-auto-import:analyzer     "package": "frontend"
  ember-auto-import:analyzer   },
  ember-auto-import:analyzer   {
  ember-auto-import:analyzer     "specifier": "ember-qunit",
  ember-auto-import:analyzer     "path": "frontend/tests/test-helper.js",
  ember-auto-import:analyzer     "isDynamic": false,
  ember-auto-import:analyzer     "package": "frontend"
  ember-auto-import:analyzer   }
  ember-auto-import:analyzer ] +0ms
  ember-auto-import:splitter output {
  "app": {
    "static": [],
    "dynamic": []
  },
  "tests": {
    "static": [],
    "dynamic": []
  }
} +0ms
  ember-auto-import:bundler extraWebpackConfig {} +0ms
Hash: 36ab3b91265ef5407c05
Version: webpack 4.16.1
Time: 60ms
Built at: 07/19/2018 2:22:29 PM
   Asset      Size  Chunks             Chunk Names
  app.js   4.3 KiB     app  [emitted]  app
tests.js  4.31 KiB   tests  [emitted]  tests
Entrypoint app = app.js
Entrypoint tests = tests.js
[./tmp/ember_auto_import_webpack-staging_dir-bG1Hzmkb.tmp/app.js] 192 bytes {app} [built]
[./tmp/ember_auto_import_webpack-staging_dir-bG1Hzmkb.tmp/tests.js] 192 bytes {tests} [built]

What might I be doing wrong? Any ideas/suggestions to debug this?

P.S. Forgot to mention - Ember and Ember CLI versions 3.3.0.

Issue importing lodash not lodash-es

Error is - Global error: Uncaught Error: Could not find module lodash imported from

I am importing lodash as import _ from 'lodash' unsure if I need additional configuration in my addons index.js file. Other imports appear to be working fine with ember-auto-import.

Will this handle all the types of transforms that can be done in ember-cli-build?

for example, I currently have these:

  app.import('node_modules/phoenix/assets/js/phoenix.js', {
    using: [{ transformation: 'cjs', as: 'phoenix' }],
  });

  // libsodium
  app.import('node_modules/libsodium/dist/modules/libsodium.js');
  app.import('node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js');
  app.import('vendor/shims/libsodium.js');
  app.import('vendor/shims/libsodium-wrappers.js');

  // qrcode
  app.import('node_modules/qrcode/build/qrcode.min.js');
  app.import('vendor/shims/qrcode.js');

  // localforage
  app.import('node_modules/localforage/dist/localforage.js');
  app.import('vendor/shims/localforage.js');

  // uuid
  app.import('node_modules/uuid/index.js', {
    using: [{ transformation: 'cjs', as: 'uuid' }]
  });

with ember-auto-import, would I just delete all that and then also delete all my vendor/shims?
(I assume I would for the non-configured imports, but am mostly asking about cjs, u/amd, etc)

great work on this library!

Broccoli Plugin: BundlerPlugin build error

Hey there,

I'm attempting to pull a dependency in from an add-on. That dependency (leaflet.js) is also a dependency of the app consuming the add-on. I believe I have my ducks in a row with ember-auto-import as well as leaflet in dependencies and not devDependencies of the add-on. My add-on code is being imported from the /addon directory, but I have imported the leaflet dependency in /app as well:

import Leaflet from 'leaflet';
export { default } from 'imi/components/map-config';

ember-auto-import is a devDependency in the consuming app while leaflet is a dependency.

This code organization is working seamlessly with other addon/app combinations. Leaflet seems to be a problem. I am using leaflet version 1.3.1 which is an ES6 module. I am confused by the following build error:

Error: imi and imi-application are using different versions of leaflet (/imi/node_modules/leaflet/dist/leaflet-src.js vs /imi-application/node_modules/leaflet/dist/leaflet-src.js)
at Splitter. (/imi-application/node_modules/ember-auto-import/js/splitter.js:77:31)
at Generator.next ()
at fulfilled (/imi-application/node_modules/ember-auto-import/js/splitter.js:4:58)

Thanks in advance for clarification on this issue.

Another jquery libraries issue

I think this might be the same as the other jquery question here.
I'm trying to import flickity.
I've tried various combinations of

import flickity from "flickity";
import "flickity";

However when I do
$('.main-carousel').flickity({})
in my component I get Uncaught ReferenceError: flickity is not defined.

Importing 0x.js

ember install ember-auto-import
npm install 0x.js --save-dev

and put this into application.js controller (btw where is best place to have it globally available?)

import { ZeroEx } from '0x.js';

but if I log in console "ZeroEx" is undefined

Error after manully deleting a file

If i manually delete a file while my "ember server" is running i got this error.
If i stop server and re-run it again, it got solved.

Dang! Looks like a Build Error.
Cannot read property 'forEach' of null
Expand stack frames
Broccoli Plugin: BundlerPlugin
Build Canceled: Broccoli Builder ran into an error with BundlerPlugin plugin. ðŸ’Β₯ Cannot read property 'forEach' of null
TypeError: Cannot read property 'forEach' of null
at Object.keys.forEach.inPath (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:145:19)
at Array.forEach ()
at groupModules (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:144:22)
at Analyzer.get imports [as imports] (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:39:23)
at Splitter.depsForBundle (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/splitter.js:17:34)
at BundlerPlugin.build (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/bundler.js:27:39)
at /Users/leonardo/Dropbox/dev/dex/node_modules/broccoli-plugin/read_compat.js:93:34
at tryCatch (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:525:12)
at invokeCallback (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:538:13)
at publish (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:508:7)

            TypeError: Cannot read property 'forEach' of null
at Object.keys.forEach.inPath (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:145:19)
at Array.forEach (<anonymous>)
at groupModules (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:144:22)
at Analyzer.get imports [as imports] (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/analyzer.js:39:23)
at Splitter.depsForBundle (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/splitter.js:17:34)
at BundlerPlugin.build (/Users/leonardo/Dropbox/dev/dex/node_modules/ember-auto-import/lib/bundler.js:27:39)
at /Users/leonardo/Dropbox/dev/dex/node_modules/broccoli-plugin/read_compat.js:93:34
at tryCatch (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:525:12)
at invokeCallback (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:538:13)
at publish (/Users/leonardo/Dropbox/dev/dex/node_modules/rsvp/dist/rsvp.js:508:7)

Feature request: Work for nested addons

I have an addon that wants to import and use luxon.

If ember-auto-import and luxon are both dependencies of the addon (not devDependencies), addon code importing luxon should work and also app code should be able to import things from luxon

πŸ‘/πŸ‘Ž

Is it mandatory to have `unsafe-eval` in the CSP?

Hi, just looking at moving from ember-browserify to ember-auto-import, and after running ember install ember-auto-import and booting my app I got a CSP error:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'"

Just wondering if it's intentional that unsafe-eval is required to be in the CSP? And if so, this could be worth documenting.

use scoped npm package

I didn't find a way to use scoped packages. Nor with trying, nor in the doc.

So just for the record, how do you use a scoped npm package ?

> ember -v
< ember-cli: 2.11.1
< node: 6.11.0

// whatever.js
import { process } from '@ngouy/easy-template';

=>
Can't resolve '@ngouy/easy-template' in '/Users/nathangouy/travail/due/www-dashboard'

Once I figured it out, I can add one or too lines into de readme to help future users

Broccoli Builder ran into an error with 'Analyzer' plugin

Just installed ember-auto-import after seeing the deprecation on ember-browserify.

Getting an error when I ember serve

Build Canceled: Broccoli Builder ran into an error with `Analyzer` plugin. πŸ’₯
Cannot read property 'elements' of undefined
TypeError: Cannot read property 'elements' of undefined
    at findAMDImports (/Users/jbryson3/code/arbiter/node_modules/ember-auto-import/lib/analyzer.js:98:5)
    at /Users/jbryson3/code/arbiter/node_modules/ember-auto-import/lib/analyzer.js:62:9
    at forEachNode (/Users/jbryson3/code/arbiter/node_modules/ember-auto-import/lib/analyzer.js:81:5)
    at forEachNode (/Users/jbryson3/code/arbiter/node_modules/ember-auto-import/lib/analyzer.js:84:7)
    at forEachNode (/Users/jbryson3/code/arbiter/node_modules/ember-auto-import/lib/analyzer.js:84:7)

It seems to alleviate the issue if I put a guard in analyzer.js

function findAMDImports(entry, imports) {
  let e = head(entry.arguments.filter(function(item) {
    return item.type === 'ArrayExpression';
  }))
  if(!e){return}
//...

Here is the entry.arguments for the offending entry

[ Node {
    type: 'StringLiteral',
    start: 323,
    end: 334,
    loc: SourceLocation { start: [Object], end: [Object] },
    extra: { rawValue: 'clipboard', raw: '\'clipboard\'' },
    value: 'clipboard' },
  Node {
    type: 'FunctionExpression',
    start: 336,
    end: 375,
    loc: SourceLocation { start: [Object], end: [Object] },
    id: null,
    generator: false,
    async: false,
    params: [],
    body:
     Node {
       type: 'BlockStatement',
       start: 348,
       end: 375,
       loc: [Object],
       body: [Array],
       directives: [] } } ]

node: 8.11.2
ember-cli: 2.13.2

cannot read property env of undefined

Happening on this line https://github.com/ef4/ember-auto-import/blob/2f2dec795ed277c0ae13aa210698bf0a6a32a860/index.js#L45

ERROR Summary:

  - broccoliBuilderErrorStack: [undefined]
  - codeFrame: [undefined]
  - errorMessage: Cannot read property 'env' of undefined
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: Cannot read property 'env' of undefined
  - name: TypeError
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: TypeError: Cannot read property 'env' of undefined
    at Class.included (/home/robbo/projects/postedin/marketplace/node_modules/ember-auto-import/index.js:43:48)
    at addons.reduce (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:381:26)
    at Array.reduce (native)
    at Class.eachAddonInvoke (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:378:24)
    at Class.included (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:648:10)
    at Class.superWrapper [as included] (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/node_modules/core-object/lib/assign-properties.js:34:20)
    at addons.reduce (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:381:26)
    at Array.reduce (native)
    at Class.eachAddonInvoke (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:378:24)
    at Class.included (/home/robbo/projects/postedin/marketplace/node_modules/ember-cli/lib/models/addon.js:648:10)

Tree Cycle Detected!

All I did was install ember-auto-import (current sha: 19f7588)

got this error:

 cat /tmp/error.dump.deb618ea0c62404c1a6a52d196fd182a.log
=================================================================================

ENV Summary:

  TIME: Thu Jun 14 2018 13:12:00 GMT-0400 (EDT)
  TITLE: ember
  ARGV:
  - /home/me/.nvm/versions/node/v8.11.1/bin/node
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin/ember
  - serve
  EXEC_PATH: /home/me/.nvm/versions/node/v8.11.1/bin/node
  TMPDIR: /tmp
  SHELL: /bin/bash
  PATH:
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/.nvm/versions/node/v8.11.1/libexec/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/bin/node_modules/npm/bin/node-gyp-bin
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/.nvm/versions/node/v8.11.1/libexec/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/bin/node_modules/npm/bin/node-gyp-bin
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/.yarn/bin
  - /home/me/.nvm/versions/node/v8.11.1/libexec/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.nvm/versions/node/v8.11.1/bin/node_modules/npm/bin/node-gyp-bin
  - /home/me/.pythons/Python-3.6.3/bin
  - /home/me/.cargo/bin
  - /usr/local/heroku/bin
  - /home/me/node_modules/.bin
  - /home/me/apps/phantomjs/bin
  - /home/me/scripts/system-utils
  - /home/me/scripts/git
  - /home/me/scripts/rails
  - /home/me/scripts
  - /home/me/.nvm/versions/node/v8.11.1/bin
  - /home/me/.cargo/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  - /home/me/.fzf/bin
  - /home/me/.rvm/bin
  PLATFORM: linux x64
  FREEMEM: 132714496
  TOTALMEM: 8242163712
  UPTIME: 622957
  LOADAVG: 1.76806640625,1.61181640625,1.4375
  CPUS:
  - Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz - 3244
  - Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz - 3192
  - Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz - 3257
  - Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz - 3192
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.10.1-DEV
  - cldr: 32.0
  - http_parser: 2.8.0
  - icu: 60.1
  - modules: 57
  - nghttp2: 1.25.0
  - node: 8.11.1
  - openssl: 1.0.2o
  - tz: 2017c
  - unicode: 10.0
  - uv: 1.19.1
  - v8: 6.2.414.50
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: Error: Tree cycle detected
    at readAndReturnNodeFor (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/broccoli-builder/lib/builder.js:99:15)
    at /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/broccoli-builder/lib/builder.js:153:24
    at tryCatch (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:538:13)
    at /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

  - codeFrame: Tree cycle detected
  - errorMessage: Build Canceled: Broccoli Builder ran into an error with `BroccoliMergeTrees` plugin. πŸ’₯
Tree cycle detected
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Build Canceled: Broccoli Builder ran into an error with `BroccoliMergeTrees` plugin. πŸ’₯
Tree cycle detected
  - name: Error
  - nodeAnnotation: TreeMerger (preprocessedApp & templates)
  - nodeName: BroccoliMergeTrees
  - originalErrorMessage: Tree cycle detected
  - stack: Error: Tree cycle detected
    at readAndReturnNodeFor (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/broccoli-builder/lib/builder.js:99:15)
    at /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/broccoli-builder/lib/builder.js:153:24
    at tryCatch (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:538:13)
    at /home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/home/me/Development/NullVoxPopuli/emberclear/packages/frontend/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)


=================================================================================

I did comment out my cjs transform for instascan (the library I was having issues loading before installing ember-auto-import:

  // app.import('node_modules/instascan/index.js', {
  //   using: [{ transformation: 'cjs', as: 'instascan' }]
  // });

the above 'works' sorta, but errors because it can't find the fs module.... not sure why it needs that.

here is my pre-ember-auto-import ember-cli-build.js: https://github.com/NullVoxPopuli/emberclear/blob/master/packages/frontend/ember-cli-build.js
(the only difference is that the instascan app.import isn't commented out)

Importing 'uuid' module errors

Getting this error during build:

Path must be a string. Received { './lib/rng.js': './lib/rng-browser.js',
  './lib/sha1.js': './lib/sha1-browser.js',
  './lib/md5.js': './lib/md5-browser.js' }

Using v0.2.1

Cannot read property 'forEach' of null

image

   TypeError: Cannot read property 'forEach' of null
    at Object.keys.forEach.inPath (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:144:23)
    at Array.forEach (<anonymous>)
    at groupModules (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:143:24)
    at AnalyzerInternal.get imports [as imports] (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:45:29)
    at Splitter.<anonymous> (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:29:42)
    at Generator.next (<anonymous>)
    at C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:3:12)
    at Splitter.depsForBundle (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:28:16)
              
                TypeError: Cannot read property 'forEach' of null
    at Object.keys.forEach.inPath (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:144:23)
    at Array.forEach (<anonymous>)
    at groupModules (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:143:24)
    at AnalyzerInternal.get imports [as imports] (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\analyzer.js:45:29)
    at Splitter.<anonymous> (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:29:42)
    at Generator.next (<anonymous>)
    at C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:3:12)
    at Splitter.depsForBundle (C:\Users\lifeart\Documents\Repositories\nextgen\node_modules\ember-auto-import\js\splitter.js:28:16)
              

vendor.js is non-deterministic

I'm running into problems with ember-auto-import generating a non-deterministic vendor.js file.

For reasons beyond my control (😒), our Ember app is built two times on two different instances of the same AWS OpsWorks App Server. Yeah, I know.

Anyway, both generated dist directories are exact carbon copies of one another, except for the vendor.js, which seems to have slight differences in module order, leading to different fingerprints in the file name.

For instance in the first line, you can see that the order of lodash.merge and lodash.frompairs is reversed.

11:13 $ colordiff vendor-6e637a855fb1298955e4f0ded1e9d3ee.js vendor-71b6d8a2bc05fdef2699448211deaa5e.js
4455c4455
< e.emberAutoImportDynamic=function(e){return r("_eai_dyn_"+e)},t("moment",[],function(){return n(0)}),t("lodash.merge",[],function(){return n(128)}),t("lodash.frompairs",[],function(){return n(126)})}()}});(window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[0],[function(e,t,n){(function(e){e.exports=function(){"use strict"
---
> e.emberAutoImportDynamic=function(e){return r("_eai_dyn_"+e)},t("moment",[],function(){return n(0)}),t("lodash.frompairs",[],function(){return n(128)}),t("lodash.merge",[],function(){return n(127)})}()}});(window.webpackJsonp_ember_auto_import_=window.webpackJsonp_ember_auto_import_||[]).push([[0],[function(e,t,n){(function(e){e.exports=function(){"use strict"
5228,5229c5228
< n(0).defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(e){return/^nm$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"vm":"VM":n?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[MΓ΄re om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},,function(e,t){e.exports=function(e){for(var t=-1,n=e?e.length:0,r={};++t<n;){var i=e[t]
< r[i[0]]=i[1]}return r}},function(e,t){var n
---
> n(0).defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(e){return/^nm$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"vm":"VM":n?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[MΓ΄re om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}()},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},,function(e,t){var n
5321c5320,5321
< function xe(e){return e}n.exports=Ee}).call(this,n(127),n(124)(e))}]]),"undefined"==typeof FastBoot&&function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClipboardJS=t():e.ClipboardJS=t()}(this,function(){return function(e){var t={}
---
> function xe(e){return e}n.exports=Ee}).call(this,n(126),n(124)(e))},function(e,t){e.exports=function(e){for(var t=-1,n=e?e.length:0,r={};++t<n;){var i=e[t]
> r[i[0]]=i[1]}return r}}]]),"undefined"==typeof FastBoot&&function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClipboardJS=t():e.ClipboardJS=t()}(this,function(){return function(e){var t={}
8297c8297
< //# sourceMappingURL=/assets/client/assets/vendor-2d8eaa94d883db59750746c87931b646.map
\ No newline at end of file
---
> //# sourceMappingURL=/assets/client/assets/vendor-84ffd757cb1627f52afc797f9e08aac0.map
\ No newline at end of file

This has been working fine for us for quite some time and just recently started breaking. Unfortunately, I can't exactly pin down when.

We are on [email protected] and use yarn, so dependencies are guaranteed to be the same on both instances.

Do you have any pointers, where I can start digging?

Incompatibility with JS preprocessors for non-JS code

First of all, thanks for the work!

Primary issue: Using ember-elm + ember-auto-import causes ember-elm to not see Elm modules in the app tree, resulting in elm code not being included in the resulting app build.
Example repo: https://github.com/omarestrella/elm-test

When attempting to move some app.import'd and broccoli-funnel'd libraries over to using auto-import, I noticed that this addon caused ember-elms preprocessor to not work since any non-JS code is not included in the resulting app tree. By the time the tree hits the addons Elm compiler, no Elm files are found.

Is there a way around this at the moment?

Some example output I am expecting to see in the final app build:

if (typeof exports == 'undefined') {
  define('elm-test/elm-modules', ['exports'], function (exports) {
    exports['default'] = Elm;
  });
} else {
  exports['default'] = Elm;
}

That is missing once you include ember-auto-import addon and build the project.

Dynamic import in dependency references wrong location

I'm trying to leverage ember-auto-import in one of my addons (ember-cli-stencil) to solve an issue where Stencil packages need to be imported through ESM.

The packages contain dynamic imports to lazy-load their component definitions. This seems to be OK, although the location of the "chunk" that it's importing is wrong.T

The file is trying to be loaded at localhost:4200/chunk.whatever.js (which fails)

screen shot 2018-07-14 at 4 35 24 pm

when it actually lives at localhost:4200/assets/chunk.whatever.js

screen shot 2018-07-14 at 4 35 48 pm

using jquery libraries

Hi I'm trying to use masonry-layout with auto-import.

app/routes/blog.js

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { schedule } from '@ember/runloop';
import $ from 'jquery';
import 'masonry-layout';

export default Route.extend({
  fastboot: service(),
  model: function(){
    return this.store.findAll('tumblr-post');
  },
  setupController: function(controller, model){
    this._super(controller, model);
    schedule('afterRender', this, function () {
      if(!this.get('fastboot.isFastBoot')){
        $('.grid').masonry({
          // options
          itemSelector: '.grid-item',
          columnWidth: 650,
          gutter: 20
        });
        $('.grid').imagesLoaded(function(){
          $(".grid").masonry();
        });
      }
    });
  }
});

I get this error, I guess because its trying to run masonry in fastboot maybe?

TypeError: Cannot read property 'prototype' of undefined
    at eval (webpack://__ember_auto_import__/./node_modules/desandro-matches-selector/matches-selector.js?:26:35)
    at Object.factory (webpack://__ember_auto_import__/./node_modules/desandro-matches-selector/matches-selector.js?:45:5)
    at ElemProto (webpack://__ember_auto_import__/./node_modules/desandro-matches-selector/matches-selector.js?:17:37)
    at eval (webpack://__ember_auto_import__/./node_modules/desandro-matches-selector/matches-selector.js?:22:2)
    at Object../node_modules/desandro-matches-selector/matches-selector.js (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:108:1)
    at __webpack_require__ (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:21:1)
    at utils (webpack://__ember_auto_import__/./node_modules/fizzy-ui-utils/utils.js?:15:7)
    at eval (webpack://__ember_auto_import__/./node_modules/fizzy-ui-utils/utils.js?:22:2)
    at Object../node_modules/fizzy-ui-utils/utils.js (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:130:1)
    at __webpack_require__ (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:21:1)
    at console (webpack://__ember_auto_import__/./node_modules/outlayer/outlayer.js?:16:9)
    at eval (webpack://__ember_auto_import__/./node_modules/outlayer/outlayer.js?:24:2)
    at Object../node_modules/outlayer/outlayer.js (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:207:1)
    at __webpack_require__ (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:21:1)
    at eval (webpack://__ember_auto_import__/./node_modules/masonry-layout/masonry.js?:15:9)
    at eval (webpack://__ember_auto_import__/./node_modules/masonry-layout/masonry.js?:23:2)
    at Object../node_modules/masonry-layout/masonry.js (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:185:1)
    at __webpack_require__ (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/ember-auto-import/app.js:21:1)
    at Module.eval [as callback] (webpack://__ember_auto_import__/./tmp/ember_auto_import_webpack-staging_dir-Hed12Pcm.tmp/entry.js?:4:61)
    at Module.exports (/Users/tony/src/datafruits/tmp/broccoli_merge_trees-output_path-5p1surf9.tmp/assets/vendor/loader/loader.js:106:1)

Errors after upgrade to 1.0

I updated auto-iimport from 0.2.6 to 1.0.0 and i got the following error:

ERROR in ./tmp/ember_auto_import_webpack-staging_dir-r6pCK2QC.tmp/entry.js Module not found: Error: Can't resolve 'C:UsersadminDocumentsOculariumOculariumFrontend 2.0OculariumFrontendCore ode_modulesocularium-sharedlibscenarioManager.js'

Looks like the slashes are gone, the correct path should be like this:

C:Users/admin/Documents/Ocularium/OculariumFrontend 2.0/OculariumFrontendCore ode_modules/ocularium-shared/lib/scenarioManager.js'

Hash: 56af320e769258f9084b
Version: webpack 4.12.1
Time: 72ms
Built at: 2018-06-25 09:57:04
Asset Size Chunks Chunk Names
app.js 4.52 KiB main [emitted] main
Entrypoint main = app.js

Log file

=================================================================================

ENV Summary:

  TIME: Tue Jun 26 2018 11:51:16 GMT+0200 (Romance Daylight Time)
  TITLE: ember
  ARGV:
  - C:\Program Files\nodejs\node.exe
  - C:\Users\admin\AppData\Roaming\npm\node_modules\ember-cli\bin\ember
  - s
  EXEC_PATH: C:\Program Files\nodejs\node.exe
  TMPDIR: C:\Users\admin\AppData\Local\Temp
  SHELL: null
  PATH:
  - C
  - \Program Files\Docker\Docker\Resources\bin;C
  - \Windows\system32;C
  - \Windows;C
  - \Windows\System32\Wbem;C
  - \Windows\System32\WindowsPowerShell\v1.0\;C
  - \Program Files\Git\cmd;C
  - \Program Files\PuTTY\;C
  - \ProgramData\ComposerSetup\bin;C
  - \Program Files (x86)\Skype\Phone\;C
  - \Users\admin\AppData\Roaming\nvm;C
  - \Program Files\nodejs;C
  - \Program Files\nodejs\;C
  - \Users\admin\AppData\Local\Microsoft\WindowsApps;C
  - \PHP;C
  - \Users\admin\AppData\Roaming\Composer\vendor\bin;C
  - \Program Files\Microsoft VS Code\bin;C
  - \Users\admin\AppData\Roaming\nvm;C
  - \Users\admin\AppData\Roaming\npm
  PLATFORM: win32 x64
  FREEMEM: 8131403776
  TOTALMEM: 17112006656
  UPTIME: 11703.1337309
  LOADAVG: 0,0,0
  CPUS:
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz - 3392
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.10.1-DEV
  - cldr: 32.0
  - http_parser: 2.8.0
  - icu: 60.1
  - modules: 57
  - napi: 3
  - nghttp2: 1.32.0
  - node: 8.11.3
  - openssl: 1.0.2o
  - tz: 2017c
  - unicode: 10.0
  - uv: 1.19.1
  - v8: 6.2.414.54
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: Error: webpack returned errors to ember-auto-import
    at webpack.run (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\ember-auto-import\js\webpack.js:67:32)
    at finalCallback (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:157:39)
    at hooks.done.callAsync.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:206:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\Hook.js:35:21)
    at emitRecords.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:204:22)
    at Compiler.emitRecords (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:319:39)
    at emitAssets.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:198:10)
    at hooks.afterEmit.callAsync.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:305:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
  - codeFrame: webpack returned errors to ember-auto-import
  - errorMessage: Build Canceled: Broccoli Builder ran into an error with `BundlerPlugin` plugin. πŸ’₯
webpack returned errors to ember-auto-import
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Build Canceled: Broccoli Builder ran into an error with `BundlerPlugin` plugin. πŸ’₯
webpack returned errors to ember-auto-import
  - name: Error
  - nodeAnnotation: BundlerPlugin
  - nodeName: BundlerPlugin
  - originalErrorMessage: webpack returned errors to ember-auto-import
  - stack: Error: webpack returned errors to ember-auto-import
    at webpack.run (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\ember-auto-import\js\webpack.js:67:32)
    at finalCallback (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:157:39)
    at hooks.done.callAsync.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:206:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\Hook.js:35:21)
    at emitRecords.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:204:22)
    at Compiler.emitRecords (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:319:39)
    at emitAssets.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:198:10)
    at hooks.afterEmit.callAsync.err (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\webpack\lib\Compiler.js:305:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\admin\Documents\Ocularium\OculariumFrontend 2.0\OculariumFrontendCore\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)

=================================================================================

Broken import in production build

I did the following:

ember install ember-auto-import
yarn add --dev lodash-es

And then imported a lodash function as follows:

import { difference } from 'lodash';

It worked like a charm in development but when I deployed the new version, I got an import error in production:

Could not find module lodash imported from <module-name>

I couldn't import the lodash module from the console manually, either.

I also checked vendor.js and didn't seem to find any trace of lodash.

Our deployment creates the production build (ember build -e production) and then uses a Netlify command to push it to their servers.

Feature request: Support WASM imports

Since this addon uses webpack under the hood, it should be trivial to import wasm modules, such as those output by wasm-pack.

Right now, this almost "Just Worksβ„’".

Declaring import { Foo } from 'some-wasm-module/wasm-wrapper.js' gets you 90% of the way there as long as the wasm wrapper imports the wasm with the syntax const wasm = import('./path_to_wasm'); (and not import wasm from './path_to_wasm').

There's only two issues blocking this that I know of:

  1. Webpack puts together a file called 0.{entry point path}.js with some of the chunking and wrapper code. This will need to be output by ember-auto-import (and made available at the URL webpack tries to download it at).

  2. It looks like webpack assigns a guid filename to the actual wasm file (in the form of {guid}.module.wasm. This file will also need to be output by ember-auto-import.

I don't know webpack very well, but I'll keep digging into this issue and see if I can get it working. I'm more than happy to provide test cases and manual testing if anyone wants to take up the mantle on this.

Size Limit/Web Performance

I'm getting these warnings, and that's got me worried. Is there any way to fix this @ef4 ?

Version: webpack 4.14.0
Time: 3157ms
Built at: 07/09/2018 9:41:20 AM
Asset Size Chunks Chunk Names
app.js 254 KiB 0 [emitted] [big] main
Entrypoint main [big] = app.js
[0] ./node_modules/process/browser.js 5.29 KiB {0} [built]
[1] ./node_modules/airbrake-js/dist/client.js 81 KiB {0} [built]
[2] ./node_modules/highcharts/highcharts.js 199 KiB {0} [built]
[3] ./node_modules/awesomplete/awesomplete.js 10.7 KiB {0} [built]
[4] ./node_modules/highcharts/modules/streamgraph.js 463 bytes {0} [built]
[5] ./node_modules/highcharts/modules/drilldown.js 9.34 KiB {0} [built]
[6] ./tmp/ember_auto_import_webpack-staging_dir-9S9NtkQU.tmp/entry.js 847 bytes {0} [built]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
app.js (254 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (254 KiB)
app.js

WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/[API] Warning: The .read and .rebuild APIs will stop working in the next Broccoli version
[API] Warning: Use broccoli-plugin instead: https://github.com/broccolijs/broccoli-plugin
[API] Warning: Plugin uses .read/.rebuild API: Filter

Can/should this be used to import non-JS assets from node_modules, e.g. CSS / SASS?

For example, I am using materialize-css, and in addition to being able to import the JS into components I want to @import SASS assets in my styles. Thus far I've been accomplishing this by using something like this in my ember-cli-build.js:

const app = new EmberApp(defaults, {
  // ...
  sassOptions: {
    includePaths: [
      'node_modules/materialize-css/sass'
    ]
  }
  // ...
}

Should I keep doing this or does ember-auto-import do something in this space as well?

Build Error (Analyzer) Cannot convert undefined or null to object

Getting this error occasionally

=================================================================================

ENV Summary:

  TIME: Thu Jul 26 2018 16:28:28 GMT-0400 (EDT)
  TITLE: ember
  ARGV:
  - /Users/penguin/.nvm/versions/node/v8.11.2/bin/node
  - /Users/penguin/git_repos/myproj/client/v3/node_modules/.bin/ember
  - serve
  - --proxy
  - http://localhost:4000
  - --port
  - 5200
  EXEC_PATH: /Users/penguin/.nvm/versions/node/v8.11.2/bin/node
  TMPDIR: /var/folders/ft/kgpw3hfn3xg3p7tg_5wtlz300000gn/T
  SHELL: /bin/zsh
  PLATFORM: darwin x64
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.10.1-DEV
  - cldr: 32.0
  - http_parser: 2.8.0
  - icu: 60.1
  - modules: 57
  - napi: 3
  - nghttp2: 1.29.0
  - node: 8.11.2
  - openssl: 1.0.2o
  - tz: 2017c
  - unicode: 10.0
  - uv: 1.19.1
  - v8: 6.2.414.54
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at _targets.Object.keys.map.fullPath (/Users/penguin/git_repos/myproj/client/v3/node_modules/ember-auto-import/lib/analyzer.js:34:84)
    at Array.map (<anonymous>)
    at Analyzer.build (/Users/penguin/git_repos/myproj/client/v3/node_modules/ember-auto-import/lib/analyzer.js:34:61)
    at /Users/penguin/git_repos/myproj/client/v3/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
  - codeFrame: Cannot convert undefined or null to object
  - errorMessage: Build Canceled: Broccoli Builder ran into an error with `Analyzer` plugin. πŸ’₯
Cannot convert undefined or null to object
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Build Canceled: Broccoli Builder ran into an error with `Analyzer` plugin. πŸ’₯
Cannot convert undefined or null to object
  - name: Error
  - nodeAnnotation: Analyzer
  - nodeName: Analyzer
  - originalErrorMessage: Cannot convert undefined or null to object
  - stack: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at _targets.Object.keys.map.fullPath (/Users/penguin/git_repos/myproj/client/v3/node_modules/ember-auto-import/lib/analyzer.js:34:84)
    at Array.map (<anonymous>)
    at Analyzer.build (/Users/penguin/git_repos/myproj/client/v3/node_modules/ember-auto-import/lib/analyzer.js:34:61)
    at /Users/penguin/git_repos/myproj/client/v3/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/Users/penguin/git_repos/myproj/client/v3/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)

=================================================================================

Whitelist

I would like the option to provide a whitelist and only import dependencies listed.

Error during eval. Possible bad escaping of module?

This happens when importing luxon (https://moment.github.io/luxon/) on an app or addon.

Steps to reproduce:

  1. Create a new app or addon
  2. Add "ember-auto-import" and "luxon" as dependencies.
  3. In some file that is requires immediately, like the application controller, add import { DateTime } from "luxon"
  4. The error I get is:
Uncaught SyntaxError: Unexpected token :
    at Object../node_modules/luxon/build/cjs-browser/luxon.js

I created a repro to help: https://github.com/cibernox/addon-with-luxon (it's an addon it can also be reproduced on an app)

Since I don't think luxon really has a syntax error in its source code, I suspect that the escaping to convert the library to a string has a bug.

not working with ember-cli 3.1.3

I have ember 3.x and following the two basic steps to install lodash-es didn't work. The import below results in capitalize is not defined.
Install:
ember install ember-auto-import
yarn add --dev lodash-es

Usage:
import { capitalize } from 'lodash-es';

Can't get ember-highcharts work

I tried importing highcharts dynamically and it is working.
But when I tried importing ember-highcharts it is giving the following error.

ember-highcharts-import

Build error for deleted files

Repro steps:

  1. Create an empty file: app/utils/function.js
  2. Didn't import anything from the empty file, so the project compiles successfully
  3. Delete app/utils/function.js
  4. Build error originating from ember-auto-import

Allow import of inner modules

First off thank you for taking the effort to write this addon.

I'm trying to move from using ember-browserify, and all my imports work except Firebase.

package.json:

"devDependencies": {
  ...
  "firebase": "5.0.4",
  ...
}

in my code as per Firebase's instruction here: https://www.npmjs.com/package/firebase#include-only-the-features-you-need

import firebase from 'firebase/app';

// These imports load individual services into the firebase namespace.
import 'firebase/messaging';

When I run the app I get the following error: Error: Could not find module 'firebase/app' imported from 'samewave-client/services/browser-push-notifications'.

Issue with importing firebase modules

As mentioned in #7 the importing of inner modules seem to bring the code into vendor.js, however there seems to be a specific issue with the firebase package.

Here's a simple app that shows the issue: https://github.com/jeanduplessis/ember-auto-import-firebase

In routes/application.js we import both the Firebase app and messaging parts:

import firebase from 'firebase/app';
import 'firebase/messaging';

The expected behaviour is that a messaging function will exist in the firebase variable. (See console.log statement in activate hook).

Unfortunately this is undefined when importing the modules like so.

If I import the Firebase kitchen sink (see https://github.com/jeanduplessis/ember-auto-import-firebase/compare/kitchen-sink) then it works, but unfortunately then all the other stuff is imported as well.

If I use ember-browserify to import the modules then it works as well (see https://github.com/jeanduplessis/ember-auto-import-firebase/compare/ember-browserify)

Add power user mode where you don't scan

It would be nice to use the bulk of this addon to just shim for you, not detect. Your config could look like:

  autoImport: {
    parsingDisabled: true,
    include: ['some-package'],
    webpack: {
      // extra webpack configuration goes here
    }
  }

This will be useful for people that already have really slow builds, but want the simplicity of this addon.

Apply Babel transpilation

It appears that currently the config/targets.js file is not considered and the code is bundled as is. It would probably be good if the resulting trees would be passed through Babel before being included in the final build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.