CodeCoupler Webpack Update Notes
To Update you have to compare in generally the files in the integrated boilerplate in
create-cc-webpack. If you did not specific modifications to the boilerplate files you can in most
of all cases just take the changes over. Here are some notes for updates which you have to manually
take some more steps.
Update from 4.6
Changes in Boilerplate files:
- The file
.babelrcwas renamed tobabel.config.json - In
.eslintrcthe propertyignorePatternswas changed from["dist/*", "node_modules/"]to["dist/", "node_modules/"] - In
.stylelintrcthe propertyignoreFileswas changed from["dist/**", "node_modules/**"]to["**/dist/**", "**/node_modules/**"]
Optimized Babel Configuration (Removed Plugins, Fix for newer Core-JS- Versions etc):
Update from 4.4
The library @codecoupler/cc-webpack-externals-plugin was upgraded and the default value for the
injection variable name of the externals path information was changed from window.ccExternals to
window.externalsPath.
Update from 4.3
The default bundlename (js and css), libraryname and path-variablename of scoped packages will change! Till version 4.3 only the part behind the slash will be used to create a default bundlename. From version 4.4 the scope name will be included.
If you are only developing a site (not a library), you can forget about making these changes. Just check whether you have adjusted these configurations in any way.
Example:
Package name: @my-scope-name/the-package-name
| Configuration | Till 4.3 | After 4.3 |
|---|---|---|
| jsName | the-package-name | my-scope-name-the-package-name |
| cssName | the-package-name | my-scope-name-the-package-name |
| libraryName | thePackageName | myScopeNameThePackageName |
| pathVarName | pathToThePackageName | pathToMyScopeNameThePackageName |
Update from 4.2
The package vue is not included as a dependency anymore. Using Vue SFC you must install vue
with:
npm i vue
Changes of .vscode/.prettierrc (Markdown Configuration removed):
From:
To:
Update from 4.1
Changes of .vscode/settings.json:
Added:
Removed:
Files removed:
shims-vue.d.ts
Update from 4.0
The file .eslintignore should be removed and the following property should be added to the
.eslintrc:
Updating from 3 to 4
Single Configuration File
In versions before you have to use the CodeCoupler Webpack CLI and use the separate configuration
files webpack.cc-config.js and webpack.externals.js. These files are not needed anymore and the
CLI is deprecated. Merge instead all your configurations into the file webpack.config.js:
const ccWebpack = require("@codecoupler/cc-webpack");
module.exports = (env) =>
ccWebpack(
// CodeCoupler Webpack Configuration
{
// CodeCoupler Webpack Externals Plugin Configuration
externals: [],
},
env,
// Webpack Configuration
{}
);
The old configuration reference was archived here.
Deprecated CLI
In Version before 4 you have to use the provided binary cc-webpack to merge all configurations and
start the compilation. This is deprecated. You can now use the standard Webpack CLI.
If you have used the boilerplate to inizialize the project you should update the following scripts
in package.json.
From:
To:
The old command reference was archived here.
Manifest & Favicon
The manifest configuration file favicon.png and manifest.webmanifest now have to be in its own
subfolder manifest instead of static. Furthermore the filename manifest.webmanifest have to be
changed into manifest.json.
Config Changes
The following configurations was removed:
staticParser.keepManifestSourcestaticParser.keepFaviconSource
The following configuration was renamed:
staticParser.favicon=>manifest.faviconstaticParser.manifest=>manifest.overridesbundle.faviconSubfolder=>bundle.manifestSubfolderproduction.banner=>bannerbundle.assetsTest=>loaders.asset_testbundle.getCdnPath=>cdn.getLink
Changed Defaults
Keep in mind that starting with version 4 the injected script tags into the static HTML files for
the bundle files will not be at the end of the body anymore. Instead they are included in the head
with the attribute defer. See https://caniuse.com/script-defer if you can use this. Otherwise
change this behaviour back to blocking injections in the configuration.
Updating PostCSS Configuration (Please use fixed Version 4.0.1)
Please change the .postcssrc file from:
To:
Update Stylelint Configuration
Insert into JSON of .stylelintrc:
Update
Update your libraries:
Updating from 3.7
The default settings for includeExternals and includeCcExternals of the CodeCoupler Webpack
Externals Plugin have changed from true to false. Keep this in mind. If you want to include
externals configurations from a package set the property includeExternals of a module
configuration to true. If you want to use externals configurations instaled via the
@cc-externals packages, set the plugin option includeCcExternals to true.
Updating from 3.2.2
The default value of the configuration staticParser.keeFaviconSource was changed from true to
false.
Updating from 2 to 3
Husky has been updated from version 6 to version 9, which means that you should execute the
following command to update the hooks npx husky.
The default filename for the source file of favicons generation is now favicon.png and not
logo.png.
Importing an HTML file will import every loadable attribute (for example - <img src="image.png">).
You may need to specify loaders in your configuration. For jpg and png the default asset loader
will be used. You can extend the list of extensions that should be used by the default asset loader.
These major version upgrades may break your build:
| Library | From Version | To Version |
|---|---|---|
| eslint | 7 | 8 |
| @typescript-eslint/eslint-plugin | 4 | 7 |
| @typescript-eslint/parser | 4 | 7 |
| babel-loader | 8 | 9 |
| clean-webpack-plugin | 3 | 4 |
| copy-webpack-plugin | 8 | 12 |
| css-loader | 5 | 7 |
| cssnano | 5 | 6 |
| favicons | 6 | 7 |
| favicons-webpack-plugin | 5 | 6 |
| html-loader | 2 | 5 |
| husky | 6 | 9 |
| lint-staged | 10 | 15 |
| mini-css-extract-plugin | 1 | 2 |
| postcss-import | 14 | 16 |
| postcss-loader | 5 | 8 |
| postcss-preset-env | 6 | 9 |
| prettier | 2 | 3 |
| stylelint | 13 | 16 |
| stylelint-config-standard | 22 | 36 |
| stylelint-prettier | 1 | 5 |
| stylelint-webpack-plugin | 2 | 5 |
| typescript | 4 | 5 |
| vue-loader | 16 | 17 |
| webpack-cli | 4 | 5 |
| webpack-dev-server | 3 | 5 |
| webpackbar | 5 | 6 |
| yargs | 16 | 17 |
| eslint-webpack-plugin | 2 | 4 |
| eslint-plugin-vue | 7 | 9 |
| eslint-plugin-prettier | 3 | 5 |
| eslint-config-prettier | 8 | 9 |
Notes:
eslintcannot be updated to 9, because of@typescript-eslint/eslint-pluginslashcannot be updated because v4+ use ES modules instead CJS modules.
Updating from 2.4
- Till 2.4 all loaders exclude the path
/node_modules/. From 2.5 this will not be done anymore. If you need to exclude the node modules directory you can set this in thewebpack.cc-config.jsconfiguration:
- The file
webpack.config.jstake now precedence. In previous versions the calculated configuration was the leading configuration.
Updating from 1 to 2
The following main libraries have been upgraded:
- Webpack from 4 to 5
- Vue from 4 to 3
Husky has been updated from version 4 to version 6, which means that the following adjustments have to be made:
- Create a directory
.husky. - Put in there a file named
pre-commitand with the following line:
- Execute the command
npx husky install - Add to the section
scriptsof thepackage.json:
Remove the following lines in the package.json:
Updating from 1.5
Starting with the version 2 all the libraries have been extensively updated to work with Webpack 5. Furthermore Vue was switched from 2 to 3. Especially in the case of the Vue update you have to migrate your Vue applications to the new version.
The Versions 1.5.x are the last versions that uses Webpack 4 and Vue 2. The last known stable
version is 1.5.11. This version do not include linting of .vue files. The following versions
1.5.12 to 1.5.14 tried to include new eslint versions, plugins and loaders but some parts of
the tool chain seems to be broken. At this time the branch 1.5.x will not be fixed anymore. If you
really need Webpack 4 and Vue 2 you should use the version 1.5.11.
Updating from 1.4
-
Please note that the versions before 1.5 used all the
*.jsand*.tsfiles as entry points. From now only the fileindex.jswill be used. -
Add the following
.babelrc, modify.eslintrcand modifywebpack.cc-config.jsto retain functionalities like striping outconsole.debugor to use experimental features (stage 3) like public and private field declarations in classes or decorators. In the versions before 1.5 this configuration was build dynamically and experimental features could only be used in TypeScript. Now it is outsourced in this configuration file:
.babelrc
.eslintrc
webpack.cc-config.js
Remove the option { production: { stripFunctions: ["..."] } } and put the functions to be striped
out into the .babelrc file.
Updating from 1.3
- Remove the following entry from
webpack.externals.jsbecausevue.jswill be already externalized by default: