Ninety-nine Pitchers of Malt

    intellij-emberjs-import-support

    0.2.0 • Public • Published

    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
      Note: Please do not specify --save-dev during npm install - it will 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({
                'src': 'app'
                // your application alias folders
                // for example: 'src': 'app', will allow you to `import { foo } from 'src/bar';`
                // where 'src/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) 2018 Yehuda Katz, Tom Dale and Ember.js contributors

    Install

    npm i intellij-emberjs-import-support

    DownloadsWeekly Downloads

    1

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    21

    Last publish

    Collaborators

    • arconamagi