Skip to content

Patterns build twice when using webpack.app.js extend. #23

@jeroenkampinga

Description

@jeroenkampinga

When extending the Webpack build with the provided webpack.app.js the mustache files always get build. Even when changing for example only .scss files. Also the patterns are build twice which is killing for performance.

I assume the watcher in the webpack.config.babel.js does a bit more than It should, is this correct or is the issue within my setup down below.

My webpack.app.js file:

module.exports = env => {
  const {ifProd, ifDev} = getIfUtils(env);

  let stylesExtract = new ExtractTextPlugin({
    filename: 'css/main.css'
  });

  const app = {
    entry: [
      './_sass/style.scss',
      './_js/main.js'
    ],
    module: {
      rules: [
        {
          test: /\.js$/,
          enforce: 'pre',
          use: {
              loader: 'eslint-loader',
              options: {
                  configFile: '.eslintrc',
              },
          },
          exclude: [/node_modules/, path.join(plConfig.paths.source.root, 'js', 'libs')],
          include: [path.join(plConfig.paths.source.root, 'js')],
        },
        {
          test: /\.scss$/,
          exclude: path.resolve('node_modules'),
          use: ExtractTextPlugin.extract({
            fallback: 'style-loader',
            use: [
              {
                loader: 'css-loader',
                options: {
                  // If you are having trouble with urls not resolving add this setting.
                  // See https://github.com/webpack-contrib/css-loader#url
                  url: false,
                  minimize: true,
                  sourceMap: true,
                }
              },
              {
                loader: 'postcss-loader',
                options: {
                  plugins: () => [autoprefixer],
                  sourceMap: true
                },
              },
              {
                loader: 'sass-loader',
                options: {
                  includePaths: [path.join(plConfig.paths.source.root, 'scss')],
                  sourceMap: true
                }
              },
            ],
          }),
        },
        {
            test: /\.(eot|svg|ttf|woff|woff2)$/,
            use: {
              loader: 'file-loader',
              options: {
                name: '/assets/fonts/[name].[ext]',
              },
            },
            include: [path.join(plConfig.paths.source.root, 'assets', 'fonts')],
        }
      ]
    },
    resolve: {
      extensions: ['.js', '.css', '.scss']
    },
    output: {
      filename: 'js/[name].js',
      path: path.resolve(plConfig.paths.public.root)
    },
    plugins: [
      // Extract the generated css
      stylesExtract,

      new StyleLintPlugin({
        syntax: 'scss'
      })
    ],
  }
  return app;
 }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions