包详细信息

ember-auto-import

embroider-build1.2mMIT2.10.0

Zero-config import from NPM packages

ember-addon, import, npm, webpack

自述文件

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.

更新日志

Changelog

Release (2024-11-01)

ember-auto-import 2.10.0 (minor)

:rocket: Enhancement

  • ember-auto-import, @ef4/v2-addon-template, @ef4/test-scenarios
    • #645 Support customizeMeta for v2 addons in classic builds (@ef4)

Committers: 1

  • Edward Faulkner (@ef4)

Release (2024-10-22)

ember-auto-import 2.9.0 (minor)

:rocket: Enhancement

  • ember-auto-import, @ef4/test-scenarios

Committers: 1

  • Edward Faulkner (@ef4)

Release (2024-09-20)

ember-auto-import 2.8.1 (patch)

:bug: Bug Fix

  • ember-auto-import

Committers: 1

  • Edward Faulkner (@ef4)

Release (2024-09-16)

ember-auto-import 2.8.0 (minor)

:rocket: Enhancement

:house: Internal

  • ember-auto-import
    • #621 fix the repo link in the published package (@mansona)
  • Other
  • ember-auto-import, @ef4/test-scenarios
  • @ef4/addon-template, @ef4/app-template, @ef4/test-scenarios

Committers: 2

Release (2024-06-24)

ember-auto-import 2.7.4 (patch)

:bug: Bug Fix

  • ember-auto-import
    • #629 only check devDependencies when checking requested range of an app package (@mansona)

:house: Internal

Committers: 1

Release (2024-05-27)

ember-auto-import 2.7.3 (patch)

:bug: Bug Fix

  • ember-auto-import, @ef4/test-scenarios
    • #620 Improved layering between app and tests bundles (@mansona)

:house: Internal

Committers: 1

  • Chris Manson (@mansona)

    Release (2023-12-23)

ember-auto-import 2.7.2 (patch)

:bug: Bug Fix

  • ember-auto-import, @ef4/test-scenarios
    • #605 Add es-compat to make asset loaders work as expected (@ef4)
    • #606 Fix dynamic import inside allowAppImports dirs (@ef4)

Committers: 1

  • Edward Faulkner (@ef4)

    Release (2023-12-12)

ember-auto-import 2.7.1 (patch)

:bug: Bug Fix

  • ember-auto-import, @ef4/test-scenarios
  • ember-auto-import

:house: Internal

Committers: 2

ember-auto-import 2.7.0 (minor)

:rocket: Enhancement

:memo: Documentation

  • ember-auto-import

:house: Internal

  • addon-template
  • Other
  • app-template, ember-auto-import

Committers: 4

2.6.3

  • BUGFIX: the babel-plugin-ember-template-compilation bugfix in the previous release was missing an explicit dependency declaration, so it didn't work 100% of the time. Fix by @mansona.

2.6.2

  • BUGFIX: automatically detect when our module shims need AMD dependencies. This eliminates the previous earlyBootSet manual workaround.
  • BUGFIX: use babel-plugin-ember-template-compilation on new-enough ember versions by @candunaj
  • INTERNAL: update tests for latest ember canary
  • BUGFIX: Fix wrong detection of ember-source version for earlyBootSet by @simonihmig

2.6.1

  • BUGFIX: earlyBootSet now defaults to empty, because it was causing problems for some apps. If you need it you need to turn it on explicitly. @NullVoxPopuli 568

2.6.0

  • ENHANCEMENT: new option earlyBootSet allows you to work around compatibility problems between classic addons and v2 addons by @NullVoxPopuli 553

2.5.0

  • ENHANCEMENT: add support for node type=module by @hjdivad 544
  • INTERNAL: upgrade to @embroider/shared-internals 2.0

2.4.3

  • BUGFIX: Move Dynamic Template Import error to runtime instead of a build error by @mansona
  • BUGFIX: Respect v2 addon's explicit externals list
  • INTERNAL: add @babel/core to app and addon test templates for compatibility with upcoming ember versions.
  • DOCS: Improve upgrade guide by @pomm0
  • BUGFIX: windows path handling fix by @void-mAlex
  • DOCS: Fix typo by @berdeblock

2.4.2

  • BUGFIX: prioritize the user's webpack devTool setting over the default provided by our forbidEval setting.

2.4.1

  • BUGFIX: avoid unnecessary full page reloads
  • DOCS: clarify upgrade guide for addon by @ctjhoa
  • BUGFIX: don't let broccoli-asset-rev mess with css chunks
  • INTERNALS: upgrade fs-extra and resolve-package-path by @SergeAstapov

2.4.0

  • ENHANCEMENT make v2 addon's with CSS work in fastboot out of the box
  • INTERNAL update @embroider/macros and @embroider/shared-internals to 1.0 by @SergeAstapov
  • BUGFIX correctly merge user-provided webpack externals with our own, by @vstefanovic97

2.3.0

  • INTERNAL update to latest @embroider/internals
  • ENHANCEMENT support v2 addons that contain @embroider/macros
  • ENHANCEMENT better error messages by @NullVoxPopuli

2.2.4

  • BUGFIX: Avoid EBADF on ReadStream early close in Node 12 by @maxfierke
  • BUGFIX: use junctions on windows as needed to avoid permissions problem
  • INTERNAL: mark test-scenarios package as private by @rwjblue
  • DOCS: fix link to upgrade guide in changelog by @ndekeister-us
  • METADATA: add directory metadata to package.json by @Turbo87

2.2.3

  • BUGFIX: export * from syntax was not detected.

2.2.2

  • BUGFIX: pass styleLoaderOptions and cssLoaderOptions correctly by @boris-petrov

2.2.1

  • BUGFIX: Prevent loss of characters in case of false end-partial-match by @timmorey
  • INTERNAL: Upgrade scenario-tester

2.2.0

  • ENHANCEMENT: significantly faster builds.
  • ENHANCEMENT: improved error messages for resolution errors by @NullVoxPopuli
  • HOUSEKEEPING: adjust which files get published by @buschtoens
  • ENHANCEMENT: relax semver check to tolerate shared versions that satisfy all consumers

2.1.0

  • FEATURE: You can now control exactly how and where ember-auto-import will insert tags into your HTML using the insertScriptsAt and insertStylesAt options.
  • FEATURE: You can add custom entrypoints to the webpack config. Combined with insertScriptsAt, this makes it possible to (for example) auto-import a family of polyfills that must run before Ember's traditional vendor.js. It's also likely to be helpful for building webworkers or other similar standalone targets.
  • FEATURE: We now properly optimize TypeScript's import type syntax, meaning if you only import the types from a package it will not be included in your build. By @buschtoens.
  • DOCS: fixes in README by @stefanpenner
  • DOCS: fixes in upgrade guide by @kiwi-josh

2.0.2

  • BUGFIX: entry chunks should respect publicAssetURL

2.0.1

  • BUGFIX: avoid warning spew from babel about loose mode.
  • DOCS: fixed docs link by @MrChocolatine

2.0.0

  • BREAKING: see the upgrade guide to v2 for the complete list of breaking changes in 2.0 with explanations and instructions.
  • BREAKING: webpack 5 upgrade by @gabrielcsapo and @ef4
  • BREAKING ENHANCEMENT: support embroider v2-formatted addons
  • BREAKING: drop support for babel 6
  • BREAKING: inject entry chunks directly into HTML
  • BREAKING: addons that use ember-auto-import 2.0 require that the app also has ember-auto-import 2.0.
  • BREAKING: apps must depend directly on webpack 5
  • BREAKING: change our alias option to more closely match webpack by doing a prefix match by default.
  • BUGFIX: fix compatibility with babel 7.26+ by @rwjblue
  • ENHANCEMENT: support auto-importing dependencies via @embroider/macros importSync by @simonihmig
  • BUGFIX: fix accidental duplication of webpack config
  • BREAKING: minimum supported Node is 12 (because 10 hit EOL on 2021-04-30)
  • BREAKING: minimum supported Ember and EmberCLI versions are both 3.4

1.12.2

  • BUGFIX allow the user's devTool setting to take priority over the default provided by forbidEval by @apellerano-pw.

1.12.1

  • COMPAT upgraded to @embroider/shared-internals 1.0 so that apps can avoid redundant copies

1.12.0

  • FEATURE: We now properly optimize TypeScript's import type syntax, meaning if you only import the types from a package it will not be included in your build. Backports #380 from v2.1.0 by @buschtoens.

1.11.3

  • NO-OP: I accidentally published 2.0.0-alpha.0 to NPM under the latest tag. This is a re-published of 1.11.2 to supplant that as latest.

1.11.2

  • BUGFIX: the new prefix matching implementation of alias turned out to be a breaking change, so we're rolling it back in order to make it opt-in.

1.11.1

  • BUGFIX: as part of the watchDependencies feature we changed webpack splitChunksPlugin config in a way that broke in apps with common lazy chunks.

1.11.0

  • HOUSEKEEPING: major test infrastructure refactor by @ef4 & @mattmcmanus
  • COMPAT: ensure babel compilation ignores a babel.config.js by @rwjblue
  • ENHANCEMENT: introduce watchDependencies option
  • ENHANCEMENT: allow unambiguous data URIs
  • ENHANCEMENT: make alias option support prefix matching by @buschtoens
  • BUGFIX: update test-support regex to work with scoped packages by @paddyobrien

1.10.1

  • BUGFIX: the previous release accidentally leaked code to browsers that was not IE11-safe.

1.10.0

  • ENHANCEMENT: we are now compatible with the Embroider package spec's handling of import(). Template string literals are allowed so long as they point unambiguously to modules within a specific package, or are unambiguously a URL.
  • BUGFIX: the test-support tree detection feature in 1.9.0 didn't actually match ember-cli's naming scheme, by @rwjblue.

1.9.0

  • ENHANCEMENT: use new API from ember-cli to reliably detect which trees are test-support only, even when addons override the default naming scheme by @rwjblue
  • ENHANCEMENT: switch to resolve-package-path for better shared caching with the rest of ember-cli by @rwjblue

1.8.0

  • ENHANCEMENT: improved leader election protocol between copies of ember-auto-import that ensures the newest one is always in charge.
  • HOUSEKEEPING: upgrades to typescript and some other deps to get better upstream types

1.7.0

  • DOCS: improvement to CONTRIBUTING.md by kiwiupover
  • BUGFIX: fix merging of webpack configs by @bendemboski
  • HOUSEKEEPING: upgrade ember-cli-babel by nlfurniss
  • HOUSEKEEPING: upgrade @embroider/core dep by simonihmig
  • HOUSEKEEPING: upgrade webpack

1.6.0

  • ENHANCEMENT: add .ts extension to the resolver allowing import of TypeScript modules without having to add the .ts extension by @buschtoens
  • DOCS: document skipBabel option by @kasunvp
  • DOCS: fix typo in README.md by @jacobq
  • DOCS: add instructions for using dynamic imports in addons by @jrjohnson
  • ENHANCEMENT: only output files for fastboot when ember-cli-fastboot is detected (can also be manually disabled with FASTBOOT_DISABLED=true environment variable) by @houfeng0923
  • HOUSEKEEPING: update CI node version to 12.x by @f1sherman
  • ENHANCEMENT: add [id] to the chunkname by @stukalin
  • BUGFIX: ensure auto-import processes the same extensions as ember-cli-babel by @dfreeman
  • BUGFIX: update minimum version of @babel/preset-env to 7.10.2 by @rwjblue

1.5.3

  • HOUSEKEEPING: upgrading deps that are failing security audits (but there was no actual vulnerability for ember-auto-import users)
  • HOUSEKEEPING: switch CI to GitHub actions
  • BUGFIX: lazily read babel config (helps interoperability with Embroider) by @stefanpenner

1.5.2

  • BUGFIX: since 1.5.0 we were using @babel/present-env but not directly depending on it, which would break apps that didn't happen to already have a copy.

1.5.1

  • BUGFIX: upgrade handlebars to eliminate a GitHub security advisory. We don't run untrusted templates, so there was no actual security risk introduced by ember-auto-import.

1.5.0

  • ENHANCEMENT: all dependencies now go through @babel/preset-env by default. This ensures that you never ship code that violates your app's declared config/targets.js. There is an explicit skipBabel option for when you know for sure a package shouldn't be transpiled.
  • DOCS: node polyfills FAQ by @jenweber
  • DOCS: fixed syntax highlighting by @ctjhoa

1.4.1

  • BUGFIX: remove ";" from concatenated CSS by @bendemboski

1.4.0

1.3.0

  • ENHANCEMENT: if you customize the webpack config to emit CSS, we will include the CSS in your ember app. Thanks @bendemboski.
  • DOCS: readme enhancements by @Turbo87, @0xadada, and @ctjhoa

1.2.21

1.2.20

  • SECURITY: disallow handlebars < 4.0.13 due to https://www.npmjs.com/advisories/755. We don't pass any untrusted input into handlebars, so there is no known actual vulnerability in ember-auto-import, but this will help people avoid getting audit warnings about their apps. Thanks @knownasilya.
  • DOCS: updated docs on publicAssetURL by @jrjohnson
  • HOUSEKEEPING: gitignore fixes by @buschtoens.
  • BUGFIX: make sure a user-provided noParse in custom webpack config can't break our own internal usage of that feature.

1.2.19

  • BUGFIX: some changes to imports were not taking effect until after an ember-cli restart.

1.2.18

  • BUGFIX: fixed a crash for people using certain customized vendor.js output paths.
  • INTERNALS: we now compile in the strictest Typescript mode.

1.2.17

  • ENHANCEMENT: interoperability with ember-cli-typescript 2.0, so that imports work in Typescript code, by @buschtoens.

1.2.16

  • ENHANCEMENT: Babel 7 support. Any combination of app & addons using Babel 6 and 7 should now work, and each one will be parsed with its own preferred parser and options.

1.2.15

  • BUGFIX: the previous release could result in a broken build if your broccoli temp location was access through a symlink.

1.2.14

  • ENHANCEMENT: new "forbidEval" option supports sites with strict CSP.
  • BUGFIX: don't leak temp dirs
  • BUGFIX: support apps with closed-over require & define by @noslouch and @ef4
  • DOCS: package.json metadata update by @chadian

1.2.13

  • BUGFIX: only attempt to insert before a sourceMapURL that's anchored to the end of the file.

1.2.12

  • BUGFIX: an analyzer rebuild bug. Hopefully the last one since I added a bunch of new test coverage around it.
  • BUGFIX: we weren't matching the exact sort order required by fs-tree-diff.

1.2.11

  • BUGFIX: apps with customized outputPaths work again.
  • BUGFIX: fixed issues around building when tests are disabled.
  • ENHANCEMENT: preserve pre-existing vendor sourcemaps

1.2.10

  • BUGFIX: 1.2.9 re-broke production builds. Now that is fixed and we have test coverage for it. Ahem.

1.2.9

  • BUGFIX: the compatibility workaround in 1.2.7 had the side-effect of breaking live-reload of addon code.

1.2.8

  • BUGFIX: previous release broke production builds for a silly reason.

1.2.7

  • HOUSEKEEPING: changes for compatibility with ember-cli 3.4-beta.
  • ENHANCEMENT: more robust heuristic for detecting the public asset path, plus the option to configure it manually.

1.2.6

  • BUGFIX: fix IE11 support by @zonkyio
  • ENHANCEMENT: allow resolution of peerDependencies

1.2.5

  • BUGFIX: use correct asset path when dynamic imports only appear within dependencies (and not within the app itself)

1.2.4

  • ENHANCEMENT: discover imports in coffeescript.

1.2.3

  • BUGFIX: tolerate multiple copies of the same dependency as long as they have the same version number (only one will be included in the app).

1.2.2

  • BUGFIX: some chunk files could appear in the final built app even though they weren't needed. Harmless, but fixed.
  • ENHANCEMENT: reload package.json during development so you don't need to restart ember-cli after adding new dependencies.
  • ENHANCEMENT: automatically configure production asset fingerprinting so it doesn't interfere with dynamic chunk loading.
  • ENHANCEMENT: add an env var that causes webpack's console output to be visible.

1.2.1

  • BUGFIX: the previous release accidentally broke interactive rebuilds!

1.2.0

1.1.0

  • BUGFIX: play nicer with other preprocessors by preserving non-JS files in the trees we analyze.
  • ENHANCEMENT: add an "alias" config option for redirecting imports from one module to another.

1.0.1

  • BUGFIX: fixed a string escaping issue that was breaking windows builds. Thanks @houfeng0923.

1.0.0

  • BUGFIX: fixed an exception after a file with imports was deleted
  • Making this 1.0.0 because no major issues have surfaced in the alpha and I think the public API is fairly stable. My outstanding TODO list is all either additive or internals-only for compatibility with ember-cli canary.

1.0.0-alpha.0

  • ENHANCEMENT: we now run a single Webpack build for an entire application, regardless of how many addons and/or the app itself are using ember-auto-import. This provides the best possible deduplication and minimal size.
  • BREAKING: the build customization options have changed. It's no longer possible to customize webpack per-module, since we're running a single global webpack build. I also removed documentation on how to swap out the webpack bundler with something else, because in practice we'll want addons to be able to standardize on one strategy.
  • I'm making this a candidate for a 1.0 release because our public API is now where I want it and it seems unlikely to need breaking changes in the near future. This is an endorsement of public API stability, not implementaiton stability, which I expect to keep improving as more people adopt and report bugs.

0.2.5

  • BUGFIX: ensure our import analyzer always runs before babel has a chance to transpile away the imports

0.2.3

  • BUGFIX: switch to enhanced-resolve to get correct entrypoint discovery semantics for every case of browser and module

0.2.2

  • PERFORMANCE: add rebuild caching.

0.2.1

  • BUGFIX: fix an exception when the app has no vendor directory

0.2.0

  • ENHANCEMENT: respect module and browser fields in package.json
  • ENHANCEMENT: work inside addons
  • ENHANCEMENT: add option for ignoring specific modules
  • ENHANCEMENT: use the ember app's babel settings to configure our babel parser to match
  • ENHANCEMENT: support importing non-main entrypoint modules from arbitrary NPM packages
  • ENHANCEMENT: make bundler strategies pluggable
  • ENHANCEMENT: switch default bundler strategy from Rollup to Webpack