Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
| [/build-tests/rush-project-change-analyzer-test](./build-tests/rush-project-change-analyzer-test/) | This is an example project that uses rush-lib's ProjectChangeAnalyzer to |
| [/build-tests/rush-redis-cobuild-plugin-integration-test](./build-tests/rush-redis-cobuild-plugin-integration-test/) | Tests connecting to an redis server |
| [/build-tests/set-webpack-public-path-plugin-test](./build-tests/set-webpack-public-path-plugin-test/) | Building this project tests the set-webpack-public-path-plugin |
| [/build-tests/webpack-local-version-test](./build-tests/webpack-local-version-test/) | Building this project tests the rig loading for the local version of webpack |
| [/eslint/local-eslint-config](./eslint/local-eslint-config/) | An ESLint configuration consumed projects inside the rushstack repo. |
| [/libraries/rush-themed-ui](./libraries/rush-themed-ui/) | Rush Component Library: a set of themed components for rush projects |
| [/libraries/rushell](./libraries/rushell/) | Execute shell commands using a consistent syntax on every platform |
Expand Down
1 change: 1 addition & 0 deletions build-tests/webpack-local-version-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist-*
33 changes: 33 additions & 0 deletions build-tests/webpack-local-version-test/config/heft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Defines configuration used by core Heft.
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json",

// TODO: Add comments
"phasesByName": {
"build": {
"cleanFiles": [{ "includeGlobs": ["lib"] }],

"tasksByName": {
"typescript": {
"taskPlugin": {
"pluginPackage": "@rushstack/heft-typescript-plugin"
}
},
"lint": {
"taskDependencies": ["typescript"],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-lint-plugin"
}
},
"webpack": {
"taskDependencies": ["typescript"],
"taskPlugin": {
"pluginPackage": "@rushstack/heft-webpack5-plugin"
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions build-tests/webpack-local-version-test/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-project.schema.json",

"operationSettings": [
{
"operationName": "_phase:build",
"outputFolderNames": ["lib"]
}
]
}
22 changes: 22 additions & 0 deletions build-tests/webpack-local-version-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "webpack-local-version-test",
"description": "Building this project tests the rig loading for the local version of webpack",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "heft --debug build --clean",
"start": "heft build-watch",
"_phase:build": "heft run --only build -- --clean"
},
"devDependencies": {
"@rushstack/heft-lint-plugin": "workspace:*",
"@rushstack/heft-typescript-plugin": "workspace:*",
"@rushstack/heft-webpack5-plugin": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/webpack-env": "1.18.8",
"eslint": "~9.25.1",
"html-webpack-plugin": "~5.5.0",
"typescript": "~5.8.2",
"webpack": "5.73.0"
}
}
3 changes: 3 additions & 0 deletions build-tests/webpack-local-version-test/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.log('Hello world!');

export const test = 'Hello world!';
24 changes: 24 additions & 0 deletions build-tests/webpack-local-version-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json.schemastore.org/tsconfig",

"compilerOptions": {
"outDir": "lib",
"rootDir": "src",

"forceConsistentCasingInFileNames": true,
"jsx": "react",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strict": true,
"types": ["webpack-env"],

"module": "esnext",
"moduleResolution": "node",
"target": "es5",
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}
31 changes: 31 additions & 0 deletions build-tests/webpack-local-version-test/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

module.exports = ({ webpack }) => {
console.log(`Webpack version: ${webpack.version}`);
const localWebpack = require.resolve('webpack');
const bundledWebpack = require.resolve('webpack', {
paths: [require.resolve('@rushstack/heft-webpack5-plugin')]
});
const localWebpackInstance = require(localWebpack);
const bundledWebpackInstance = require(bundledWebpack);
if (localWebpack === bundledWebpack || localWebpackInstance === bundledWebpackInstance) {
throw new Error('Webpack versions match between bundled and local, cannot test rig loading.');
}
if (webpack.version !== localWebpackInstance.version) {
throw new Error('Webpack is not the same version as the local installation');
}

// Verify that the Compiler instances match the local version.
if (webpack.Compiler !== localWebpackInstance.Compiler) {
throw new Error('Webpack instances do not match the local installation');
}
if (webpack.Compiler === bundledWebpackInstance.Compiler) {
throw new Error('Received webpack instance is the same as the bundled version');
}
return {
mode: 'development',
entry: {
'test-bundle': `${__dirname}/lib/index.js`
}
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-webpack5-plugin",
"comment": "Use project-level webpack dependency when it's installed.",
"type": "minor"
}
],
"packageName": "@rushstack/heft-webpack5-plugin"
}
Loading