Code hinting on transpiled ES6 Module in WebStorm fails

106 Views Asked by At

I'm trying to setup an ES2015 lib that's added to my other ES2015 projects. I've tried abunch and this is currently where I am: I have ES2015 modules that are transpiled to 5 and then use import in my ES2015 modules in my base project. My Lib just has an index file that exports a test module:

My problem exists in that everything works in the browser, but I have no code hinting in WebStorm when I import, so my lib is not very useful.

Import statement:

import { TestModule } from 'sfl';

Failed Code Hinting:

enter image description here

enter image description here

ES2015 index.js:

export TestModule from './TestModule';

ES2015 TestModule.js:

export default class TestModule {
    constructor() {
        this.test = 'test';
    }

    static logTest(content) {
        window.console.log(content);
    }
}

Which transpiled looks like:

ES5 index.js:

'use strict';
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TestModule = undefined;

var _TestModule2 = require('./TestModule');

var _TestModule3 = _interopRequireDefault(_TestModule2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.TestModule = _TestModule3.default;

ES5 TestModule.js:

'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var TestModule = function () {
    function TestModule() {
        (0, _classCallCheck3.default)(this, TestModule);

        this.test = 'test';
    }

    (0, _createClass3.default)(TestModule, null, [{
        key: 'logTest',
        value: function logTest(content) {
            window.console.log(content);
        }
    }]);
    return TestModule;
}();

exports.default = TestModule;
module.exports = exports['default'];

babelrc:

{
  "presets": ["es2015", "stage-1"],
  "plugins": ["transform-runtime", "add-module-exports"]
}
0

There are 0 best solutions below