0

I am migrating a js (es5) only project to webpack + es6 + Typescript. Before migration, all js files were simply concatenated and now I want to start with webpack doing the same.

The problem: When the eslint-loader outputs errors I get for each eslint error a long list of all my webpack-entry files.

As first phase I wouldn't like to change the code to rely solely on imports and keep concatenation.

I have the following webpack conf:

const glob = require("glob");
const path = require('path');
const pkg = require(path.join(__dirname, '../package.json'));

module.exports = (env) => {
    const isProd = env === "production";
    const config = {
        rootDir: path.join(__dirname, '../root/'),
        buildDir: path.join(__dirname, '../build/')
    }
    return {

        entry: {

            App: [
                `${config.rootDir}/app.module.js`,
                `${config.rootDir}/app.config.js`,
                `${config.rootDir}/app.controller.js`,
                ...glob.sync(`${config.rootDir}/nodes/**/*.js`)
            ],
            Documents: [
                `${config.rootDir}/nodes/appNodes.module.
                `${config.rootDir}/documents/documentation.js`,
            ]

        },
        output: {
            path: `${config.buildDir}/js/`,
            filename: `${pkg.name}[name].min.js`
        },
        watch: !isProd,
        resolve: {
            extensions: ['.ts', '.tsx', '.js']
        },
        devServer: {

            contentBase: path.join(__dirname, '../dist/'),
            port: 2222

        },
        devtool: isProd? 'source-map' : 'cheap-module-eval-sourcemap',
        module: {
            rules: [
                { test: /.tsx?$/, use: ['awesome-typescript-loader'] },
                { test: /.jsx?$/, use: [
                        {loader: 'awesome-typescript-loader'},
                        {
                            loader: 'eslint-loader'
                            // options: {formatter: friendlyFormatter}
                        }
                    ]
                },
                { test: /.html$/, use: 'raw-loader' },
                { test: /\.json$/, use: 'json-loader' },
                { test: /\.(s*)css$/, use: ['style-loader', 'css-loader', 'sass-loader'] }
            ]
        },
        plugins: [

        ]
    }

}

Here is an example of a single error (I have plenty) :

    ERROR in ./root/nodes/upperBar/mtSCBUpperBar.js

    /Users/nadavp/mt5/root/webapp/mt.web.ui/root/nodes/upperBar/mtSCBUpperBar.js
      28:1  error  Expected indentation of 8 spaces but found 12  indent
      29:1  error  Expected indentation of 8 spaces but found 12  indent

    ✖ 2 problems (2 errors, 0 warnings)
      2 errors, 0 warnings potentially fixable with the `--fix` option.

     @ multi ./root//app.module.js ./root//app.config.js ./root//app.controller.js 
./root/nodes/appNodes.module.js 
./root/nodes/dashboard/mtWidget.js 
./root/nodes/dashboard/mtDash.js 
./root/nodes/dashboard/mtAWidget.js 
....

The list of files goes on and on for each file that has an error... I need to hide this list. Any ideas?

Nadav Parag
  • 161
  • 3

1 Answers1

0

Finally found it!! I added to the webpack config:

stats: {
    moduleTrace: false
}
Nadav Parag
  • 161
  • 3