Skip to content

Ember.js: support of `import from '@ember/..'` for JetBrains IDEs (IntelliJ, WebStorm, ...)

License

Notifications You must be signed in to change notification settings

arconamagi/intellij-emberjs-import-support

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package will fix unresolved Ember.js imports like import from '@ember/..' for JetBrains IDEs (Idea, WebStorm, ...)

Installation

In your project folder invoke:

  • npm i intellij-emberjs-import-support --no-save
    Note: double check that intellij-emberjs-import-support was not added to your package.json - this may lead to Ember.js' error:
    The intellij-emberjs-import-support addon could not be found at ../node_modules/intellij-emberjs-import-support.

  • in the project's root create webpack.config.js file with the following content:

/* eslint-disable */
const path = require('path');

function aliasEmberDirs(appAlias) {
    const emberDirs = [
        '/application', '/array', '/component', '/controller', '/object', '/polyfills',
        '/service', '/routing', '/runloop', '/utils', ''
    ];
    const emberBaseDir = 'node_modules/intellij-emberjs-import-support/@ember';
    return emberDirs.reduce(function(result, dir) {
        result[`@ember${dir}`] = emberBaseDir + dir;
        return result;
    }, appAlias);
}

module.exports = {
    resolve: {
        modules: [
            path.join(__dirname, 'node_modules/intellij-emberjs-import-support/@ember-packages'),
            'node_modules',
        ],
        root: path.resolve(__dirname),
        alias: aliasEmberDirs({
            'myapp': 'app'
            // your application alias folders
            // for example: 'myapp': 'app', will allow you to `import { foo } from 'myapp/bar';`
            // where 'myapp/bar' is located in `app/bar` folder.
        })
    }
};
  • Turn On Webpack support in JetBrains IDE: Preferences | Languages & Frameworks | JavaScript | Webpack
    and set the config file to webpack.config.js which was just created.

That's it. import { .. } from '@ember/..' should be resolved by IDE now.

Improvements

This package is not ready yet, so any help is appreciated.

Feel free to create a Pull Requests with improvements / fixes.

Licenses

This package is licensed under MIT. Copyright (c) 2019 Dmitriy Labuzov.

It also contains /@ember-packages subfolder from Ember.js (https://github.com/emberjs/ember.js/) Which is also licensed under MIT. Copyright (c) 2019 Yehuda Katz, Tom Dale and Ember.js contributors

About

Ember.js: support of `import from '@ember/..'` for JetBrains IDEs (IntelliJ, WebStorm, ...)

Resources

License

Stars

Watchers

Forks

Packages

No packages published