ng-annotate-loader
ng-annotate-loader copied to clipboard
Webpack 4
Is there any chance that ng-annotate-loader will support webpack 4?
@benneq Hello! Eventually it will. Any help with that is appreciated.
I could only provide help with testing. Push some beta to npm and I'll see if it works :)
EDIT: I set up a mini sample project, and it seems to work with webpack 4 already. In a few days I can maybe test it with our real project.
package.json:
{
"name": "wp4test",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"build": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"devDependencies": {
"ng-annotate-loader": "0.6.1",
"ng-annotate-patched": "1.7.0",
"ts-loader": "4.0.0",
"typescript": "2.7.2",
"webpack": "4.0.0",
"webpack-cli": "2.0.8"
}
}
webpack.config.js:
'use strict';
module.exports = {
devtool: 'inline-source-map',
entry: {
main: './src/index.ts'
},
output: {
filename: '[name].js',
path: __dirname + '/dist'
},
module: {
rules: [
{
test: /\.ts?$/,
loader: 'ng-annotate-loader?ngAnnotate=ng-annotate-patched!ts-loader'
}
]
},
resolve: {
extensions: [ '.ts', '.js' ]
}
};
index.ts:
function bar(HelloService) {'ngInject';
}
resulting main.js contains:
bar.$inject = ["HelloService"];function bar(HelloService) {
'ngInject';
}
Seems to work for me on a mid-sized project
Works for me too.