Skip to content

Compilation triggered without changes #1122

@RDeluxe

Description

@RDeluxe
  • Operating System: Windows 10
  • Node Version: 8.1.4
  • NPM Version: 5.3.0 (using yarn 0.27.5)
  • webpack Version: 3.5.5
  • webpack-dev-server Version: 2.7.1
  • IDE : VSCode
  • This is a bug
  • This is a feature request
  • This is a modification request

Code

webpack.common.js :

var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var helpers = require("./helpers");
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
const { TsConfigPathsPlugin } = require('awesome-typescript-loader');

module.exports = {
  entry: {
    "polyfills": "./polyfills.ts",
    "app": "./src/main.ts"
  },

  resolve: {
    extensions: [
      ".js", ".ts"
    ],
    alias: {
      styles: path.resolve(__dirname, '../src/style/styles.scss'),
      vendors: path.resolve(__dirname, '../src/vendors/')
    },
    plugins: [
      new TsConfigPathsPlugin({
        configFileName: path.resolve(__dirname, '../tsconfig.json'),
        compiler: "typescript"
      }
      )
    ]
  },

  module: {
    rules: [
      {
        test: /\.ts$/,
        loaders: ['awesome-typescript-loader', 'angular2-template-loader']
      },
      {
        test: /\.html$/,
        use: "html-loader"
      },
      {
        test: /\.pug$/,
        use: ["raw-loader", "pug-html-loader"]
      },
      {
        test: /\.(css|scss|sass)$/,
        include: path.resolve(__dirname, '../src/style'),
        include: path.resolve(__dirname, '../src/app'),
        loaders: ['to-string-loader'].concat(ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: [
            {
              loader: 'css-loader',
              options: {
                alias: {
                  assets: path.resolve(__dirname, '../src/assets')
                },
                sourceMap: true
              }
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: true
              }
            }
          ]
        }))
      },
      {
        test: /\.(png|jpe?g|gif|svg|woff|woff2|otf|ttf|eot|ico)$/,
        use: "file-loader?name=assets/[name].[hash].[ext]"
      }
    ]
  },

  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: ["app", "vendor", "polyfills"]
    }),

    new CopyWebpackPlugin([
      { from: 'src/assets/i18n/', to: 'assets/i18n' }
    ]),

    new HtmlWebpackPlugin({
      template: "index.html"
    }),

    // Workaround for Angular-SystemJS-Webpack(2) WARNINGS
    new webpack.ContextReplacementPlugin(
      /angular(\\|\/)core(\\|\/)@angular/,
      helpers.root('.'),
      {
        // your Angular Async Route paths relative to this root directory
      }
    )
  ]
};

webpack.dev.js

var webpackMerge = require("webpack-merge");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var commonConfig = require("./webpack.common.js");
var helpers = require("./helpers");

module.exports = webpackMerge(commonConfig, {
  devtool: "cheap-module-eval-source-map",

  output: {
    path: helpers.root("dist"),
    filename: "[name].js",
    chunkFilename: "[id].chunk.js"
  },

  plugins: [
    new ExtractTextPlugin("[name].css")
  ],

  devServer: {
    watchOptions: {
      aggregateTimeout: 500,
      ignored: "../node_modules/**"
    }
  }
});

Expected Behavior

Compilation triggers only when I modify and save a file.

Actual Behavior

Compilation triggers randomly without any action on my side (when I'm checking my DOM in my browser, etc.)

For Bugs; How can we reproduce the behavior?

I have no idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions