andrey-skl / ng-annotate-loader

Webpack loader to annotate angular applications
MIT License
120 stars 28 forks source link

Module build failed: Error: "../bootstrap.js" is not in the SourceMap. #20

Closed mqliutie closed 8 years ago

mqliutie commented 8 years ago

Hello, I am uncertain if the problem is leaded by this loader. When I run

webpack(webpackConfig, function(err, stats) {
        if(err) throw new gutil.PluginError("webpack:build", err);
        gutil.log("[webpack:build]", stats.toString({
            colors: true
        }));
        callback();
    });

the error as below:

ERROR in ./src/client/core/bootstrap.js
Module build failed: Error: "../bootstrap.js" is not in the SourceMap.
    at SourceMapConsumer_sourceContentFor [as sourceContentFor] (/Users/missl/htdocs/angular-lazyload-webpack/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-consumer.js:697:15)
    at SourceMapGenerator.<anonymous> (/Users/missl/htdocs/angular-lazyload-webpack/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-generator.js:233:42)
    at Array.forEach (native)
    at SourceMapGenerator_applySourceMap [as applySourceMap] (/Users/missl/htdocs/angular-lazyload-webpack/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-generator.js:232:34)
    at Object.module.exports (/Users/missl/htdocs/angular-lazyload-webpack/node_modules/ng-annotate-loader/loader.js:47:17)

webpackConfig as below :

const path = require ("path");
const webpack = require ('webpack');
var config = {
    cache: true,
    devtool: 'source-map',
    entry: {
        app: './src/client/core/bootstrap.js',
    },
    output: {
        path: path.join (__dirname, "dist"),
        filename: '[name].bundle.js',
        chunkFilename: '[id].bundle.js'
    },
    //devServer: {
    //    contentBase: __dirname + '/src/',
    //},
    resolve: {
        root: __dirname + '/src/', //一定要是绝对路径
    },
    module: {
        noParse: [],
        loaders: [{
            test: /\.js$/,
            exclude: /node_modules/,
            loader: 'ng-annotate!babel'
        }, {
            test: /\.html$/,
            loader: 'raw'
        }]
    },
    plugins: [
        new webpack.ProvidePlugin ({
            // Automtically detect jQuery and $ as free var in modules
            // and inject the jquery library
            // This is required by many jquery plugins
            jQuery: "jquery",
            $: "jquery"
        }),
        new webpack.optimize.UglifyJsPlugin ()
    ]
};

module.exports = config;

Thanks for your help!

andrey-skl commented 8 years ago

So, have you tried to turn off ng-annotate-loader and try again?

mqliutie commented 8 years ago

This project is based on angular, can I turn off ng-annotate-loader?

I have tried to turn off but the error is r is not using explicit annotation and cannot be invoked in strict mode.

When I set angular.bootstrap({ strictDi: false }); the error is Failed to instantiate module test1.route due to: Unknown provider: e

test1.route only used $stateProvider

Thanks again

mqliutie commented 8 years ago

I have updated ng-annotate-loader, the error doesn't exist. But there is some other errors. I try to solve it. Thanks!

andrey-skl commented 8 years ago

0.1.1 should fix this.