Reputation: 45
I'm struggling again with my IDE and my projects running under Angular 1.4, ES 5.1. Until now, projects where built with some gulp tasks, and AMD modules + RequireJS + bower for the Angular implementation. Everything was doing the right way (custom directives were auto completed).
I've migrated the whole thing under webpack 4, with everything ruled by some module.exports
things and require('lib')
(under node 8).
Now my custom directives are no longer auto completed.
HTML
and ziiip/node_modules
angular.js
file in debug mode in those libs and it changes nothing, even after the "Invalid cache / restart" thing.I've attached a small example of my implementation, feel free to comment but my only questions are those :
The whole project is working when running a webpack dev server and I've attached a sample
Upvotes: 0
Views: 159
Reputation: 93748
restrict
value explicitly (WEB-36024):
module.exports = angular
.module('app.ziiip', [])
.directive('customDirective', function () {
return {
restrict: 'E',
template: require('./partials/custom-directive.html')
};
});
enabling Node.js coding assistance in Settings | Languages & Frameworks | Node.js and NPM should fix the warning for require
; but I'd suggest disabling JavaScript | Node.js | Missing require() statement and JavaScript | General | Missing import statement inspections as well: as you are working in CommonJS context, the IDE expects modules being exported/imported explicitly
in node_modules/angular/angular.js
, parameter is documented as @param {string|DOMElement} element
, and document
is resolved to var document: Document
in lib.dom.d.ts
; PhpStorm can't match types and thus shows the warning. You can suppress it by adding // noinspection JSCheckFunctionSignatures
comment
Upvotes: 1