Skip to content

Commit

Permalink
chore(demo): drop legacy webpack hack (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov authored Dec 7, 2023
1 parent ad09b58 commit c4ca719
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
32 changes: 4 additions & 28 deletions projects/demo/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,6 @@ const RAW_QUERY = /raw/;
*/
const DONT_MUTATE_RAW_FILE_CONTENTS = ['*.ts', '*.less', '*.html', '*.css'];

/**
* [Fixed bug in Node.js 18]
* error:0308010C:digital envelope routines::unsupported
*
* TODO: after upgrading of angular/nx deps run `npm audit fix` and drop this temporary workaround
* Learn more: https://stackoverflow.com/a/73027407
*
* https://github.com/webpack/webpack/issues/13572#issuecomment-923736472
* Useful when needing to revert to a legacy algorithm
* (OpenSSL / potentially less secure one) to temporarily
* address any compatibility issues.
*
* output.hashFunction doesn't work now,
* upgrade @angular-devkit/build-angular to v14 and use
*
* output: {
* hashFunction: `xxhash64`,
* },
*
* instead of:
*/
const crypto = require('crypto');

const fallbackCreateHash = crypto.createHash;

crypto.createHash = (algorithm: string) =>
fallbackCreateHash(algorithm === 'md4' ? 'sha256' : algorithm);

const config: Configuration = {
module: {
/**
Expand All @@ -70,11 +42,15 @@ const config: Configuration = {
vue$: 'vue/dist/vue.esm-bundler.js',
},
},
output: {
hashFunction: 'xxhash64',
},
};

export default (ngConfigs: Configuration): Configuration => {
const ngRules = [...(ngConfigs.module?.rules || [])].map(rule => {
if (
rule &&
typeof rule === 'object' &&
DONT_MUTATE_RAW_FILE_CONTENTS.some(
pattern => rule.test instanceof RegExp && rule.test?.test(pattern),
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@taiga-ui/tsconfig",
"exclude": ["projects/demo-integrations"],
"exclude": ["projects/demo-integrations", "projects/**/*.spec.ts"],
"angularCompilerOptions": {
"strictTemplates": true
},
Expand Down

0 comments on commit c4ca719

Please sign in to comment.