Skip to content

Use ember-auto-import to import npm modules #1959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/routes/crate/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { observer } from '@ember/object';
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import semver from 'semver';
import { prerelease } from 'semver';

import fetch from 'fetch';
import ajax from 'ember-fetch/ajax';
Expand All @@ -21,7 +21,7 @@ export default Route.extend({
const controller = this.controllerFor(this.routeName);
const maxVersion = crate.get('max_version');

const isUnstableVersion = version => !!semver.prerelease(version);
const isUnstableVersion = version => !!prerelease(version);

const fetchCrateDocumentation = () => {
if (!crate.get('documentation') || crate.get('documentation').substr(0, 16) === 'https://docs.rs/') {
Expand Down
19 changes: 0 additions & 19 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,5 @@ module.exports = function(defaults) {
},
});

// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
app.import('node_modules/timekeeper/lib/timekeeper.js', {
using: [{ transformation: 'cjs', as: 'timekeeper' }],
});
app.import('node_modules/semver/semver.js', {
using: [{ transformation: 'cjs', as: 'semver' }],
});

return app.toTree();
};
Loading