Skip to content

CodeCoupler Webpack Howto's

Change devServer Port

Ton contrast the default port "8080" of the devServer change this in the file webpack.config.js in the root folder:

webpack.config.js

1
2
3
4
5
module.exports = {
  devServer: {
    port: 8081
  }
};

Exclude node_modules

webpack.cc-config.js

1
2
3
4
5
6
7
8
module.exports = {
  loaders: {
    //Exclude all css files from node modules directory
    css: {
      exclude: /node_modules/,
    },
  },
};

Change Destination Output

webpack.config.js

1
2
3
4
5
6
7
const path = require("path");
module.exports = {
  output: { path: path.join(process.cwd(), "another-dist") },
  devServer: {
    contentBase: path.join(process.cwd(), "another-dist")
  }
};

Filter Head Tags in Static HTML Files

GetFilter only Bootstrap Tags from CodeCoupler Externals Configuration and all other Tags from Compiling Result:

1
2
3
4
5
6
7
8
<%=
  htmlWebpackPlugin.tags.headTags.filter((tag) =>
    (tag.attributes.src && tag.attributes.src.startsWith("vendor/bootstrap")) ||
    (tag.attributes.href && tag.attributes.href.startsWith("vendor/bootstrap")) ||
    (tag.attributes.src && !tag.attributes.src.startsWith("vendor/")) ||
    (tag.attributes.href && !tag.attributes.href.startsWith("vendor/"))
  ).join('')
%>