Giter Club home page Giter Club logo

intellij-emberjs-import-support's Introduction

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', '/object',
        '/polyfills', '/service', '/routing', '/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, and any help is appreciated.

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

Licenses

This package is licensed under MIT. Copyright (c) 2018 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

intellij-emberjs-import-support's People

Contributors

arconamagi avatar

Watchers

James Cloos avatar Scott Werner avatar

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.