Skip to content

Commit

Permalink
[NodeJS] Update hashing algorithm for webpack (#8835)
Browse files Browse the repository at this point in the history
* Update hashing algorithm for webpack

Needed to unblock Node >16

* Tabs -> spaces
  • Loading branch information
paulcam206 authored Feb 27, 2024
1 parent b8c408c commit 126c2a2
Show file tree
Hide file tree
Showing 11 changed files with 599 additions and 588 deletions.
79 changes: 40 additions & 39 deletions source/nodejs/adaptivecards-aaf-testapp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,48 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = (env, argv) => {
const mode = argv.mode || 'development';
const devMode = mode === "development";
const mode = argv.mode || 'development';
const devMode = mode === "development";

console.info('running webpack with mode:', mode);
console.info('running webpack with mode:', mode);

return {
mode: mode,
entry: {
"adaptivecards-aaf-testapp": "./src/app.ts",
},
output: {
path: path.resolve(__dirname, "dist"),
filename: devMode ? "[name].js" : "[name].min.js",
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
return {
mode: mode,
entry: {
"adaptivecards-aaf-testapp": "./src/app.ts",
},
output: {
path: path.resolve(__dirname, "dist"),
hashFunction: "xxhash64",
filename: devMode ? "[name].js" : "[name].min.js",
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: "AAF JavaScript Runtime test application",
template: "./index.html"
}),
title: "AAF JavaScript Runtime test application",
template: "./index.html"
}),
new MiniCssExtractPlugin({
filename: '[name].css'
})
]
}
filename: '[name].css'
})
]
}
}
115 changes: 58 additions & 57 deletions source/nodejs/adaptivecards-controls/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,64 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = (env, argv) => {
const mode = argv.mode || 'development';
const devMode = mode === "development";
const mode = argv.mode || 'development';
const devMode = mode === "development";

console.info('running webpack with mode:', mode);
console.info('running webpack with mode:', mode);

return {
mode: mode,
entry: {
"adaptivecards-controls": "./src/adaptivecards-controls.ts",
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: devMode ? "[name].js" : "[name].min.js",
libraryTarget: "umd",
library: "ACControls",
umdNamedDefine: true,
publicPath: "/dist/",
globalObject: "this"
},
devtool: devMode ? "inline-source-map" : "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'adaptivecards-controls.css',
}),
new CopyWebpackPlugin({
patterns: [{
from: 'src/adaptivecards-controls.css',
to: '../lib/[name][ext]'
},
{
from: 'src/adaptivecards-controls.css',
to: '../dist/[name][ext]'
}],
options: {
concurrency: 8
}
})
]
};
return {
mode: mode,
entry: {
"adaptivecards-controls": "./src/adaptivecards-controls.ts",
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: devMode ? "[name].js" : "[name].min.js",
hashFunction: "xxhash64",
libraryTarget: "umd",
library: "ACControls",
umdNamedDefine: true,
publicPath: "/dist/",
globalObject: "this"
},
devtool: devMode ? "inline-source-map" : "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'adaptivecards-controls.css',
}),
new CopyWebpackPlugin({
patterns: [{
from: 'src/adaptivecards-controls.css',
to: '../lib/[name][ext]'
},
{
from: 'src/adaptivecards-controls.css',
to: '../dist/[name][ext]'
}],
options: {
concurrency: 8
}
})
]
};
};
133 changes: 67 additions & 66 deletions source/nodejs/adaptivecards-designer-app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,73 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = (env, argv) => {
const mode = argv.mode || 'development';
const devMode = mode === "development";
const mode = argv.mode || 'development';
const devMode = mode === "development";

console.info('running webpack with mode:', mode);
console.info('running webpack with mode:', mode);

return {
mode: mode,
entry: {
"adaptivecards-designer-app": "./src/app.ts",
},
output: {
path: path.resolve(__dirname, "dist"),
filename: devMode ? "[name].js" : "[name].min.js",
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.ttf$/,
loader: "file-loader"
},
{
test: /\.css$/,
use: [
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /\.svg$/,
type: 'asset/resource'
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'node_modules/adaptivecards-designer/src/containers/**/*',
to: 'containers/[name][ext]'
},
{
// the designer expects to find its CSS here. an alternative for a consumer would
// be to make sure they load it themselves.
from: 'node_modules/adaptivecards-designer/dist/adaptivecards-designer.css',
to: 'adaptivecards-designer.css'
}
]
}),
new HtmlWebpackPlugin({
title: "Adaptive Cards Designer",
template: "./index.html"
}),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
new MonacoWebpackPlugin({
languages: ['json']
})
]
}
return {
mode: mode,
entry: {
"adaptivecards-designer-app": "./src/app.ts",
},
output: {
path: path.resolve(__dirname, "dist"),
hashFunction: "xxhash64",
filename: devMode ? "[name].js" : "[name].min.js",
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
exclude: /(node_modules|__tests__)/
},
{
test: /\.ttf$/,
loader: "file-loader"
},
{
test: /\.css$/,
use: [
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /\.svg$/,
type: 'asset/resource'
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'node_modules/adaptivecards-designer/src/containers/**/*',
to: 'containers/[name][ext]'
},
{
// the designer expects to find its CSS here. an alternative for a consumer would
// be to make sure they load it themselves.
from: 'node_modules/adaptivecards-designer/dist/adaptivecards-designer.css',
to: 'adaptivecards-designer.css'
}
]
}),
new HtmlWebpackPlugin({
title: "Adaptive Cards Designer",
template: "./index.html"
}),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
new MonacoWebpackPlugin({
languages: ['json']
})
]
}
}
Loading

0 comments on commit 126c2a2

Please sign in to comment.