Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 4 #46

Open
benneq opened this issue Feb 25, 2018 · 4 comments
Open

Webpack 4 #46

benneq opened this issue Feb 25, 2018 · 4 comments

Comments

@benneq
Copy link

benneq commented Feb 25, 2018

Is there any chance that ng-annotate-loader will support webpack 4?

@andrey-skl
Copy link
Owner

@benneq Hello! Eventually it will. Any help with that is appreciated.

@benneq
Copy link
Author

benneq commented Feb 25, 2018

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';
}

@urish
Copy link

urish commented Mar 6, 2018

Seems to work for me on a mid-sized project

@gsikorski
Copy link

Works for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants