Skip to content

Commit 99777c9

Browse files
committed
Fix up projects so everything builds successfully
1 parent f0a227e commit 99777c9

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

build-tests-samples/heft-storybook-react-tutorial/config/heft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
/**
4141
* The path to the plugin package.
4242
*/
43-
"plugin": "@rushstack/heft-webpack5-plugin"
43+
"plugin": "@rushstack/heft-webpack4-plugin"
4444

4545
/**
4646
* An optional object that provides additional settings that may be defined by the plugin.

build-tests/heft-sass-test/config/heft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
/**
4141
* The path to the plugin package.
4242
*/
43-
"plugin": "@rushstack/heft-webpack5-plugin"
43+
"plugin": "@rushstack/heft-webpack4-plugin"
4444

4545
/**
4646
* An optional object that provides additional settings that may be defined by the plugin.

build-tests/heft-sass-test/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const path = require('path');
44
const Autoprefixer = require('autoprefixer');
55
const HtmlWebpackPlugin = require('html-webpack-plugin');
6-
const sass = require('node-sass');
76

87
/**
98
* If the "--production" command-line parameter is specified when invoking Heft, then the

heft-plugins/heft-dev-cert-plugin/src/DevCertPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import type {
1010
IScopedLogger
1111
} from '@rushstack/heft';
1212
import { CertificateManager, ICertificate } from '@rushstack/debug-certificate-manager';
13-
import { Configuration as WebpackDevServerConfig } from 'webpack-dev-server';
13+
14+
// IMPORTANT: To simplify versioning, 'webpack-dev-server' is a devDependency, not a regular dependency
15+
import type { Configuration as WebpackDevServerConfig } from 'webpack-dev-server';
1416

1517
export interface IWebpackConfigPartial {
1618
devServer?: WebpackDevServerConfig;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// The webpack-dev-middleware@5.3.1 project has a phantom dependency on @types/node
2+
// and so "npm install" chooses the "*" latest version. As a result, their index.d.ts
3+
// has a reference to fs.StatSyncFn which is new in @types/node@16. As of this writing
4+
// Node 12 is still LTS so we need to support it.
5+
// Upstream issue: https://github.com/webpack/webpack-dev-middleware/issues/1194
6+
declare module 'fs' {
7+
// eslint-disable-next-line
8+
export type StatSyncFn = any;
9+
}

heft-plugins/heft-sass-plugin/src/SassTypingsGenerator.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import * as path from 'path';
55
import { render, Result, SassError } from 'node-sass';
6-
import postcss from 'postcss';
6+
import * as postcss from 'postcss';
77
import cssModules from 'postcss-modules';
88
import { FileSystem } from '@rushstack/node-core-library';
99
import { IStringValueTypings, StringValuesTypingsGenerator } from '@rushstack/typings-generator';
@@ -66,13 +66,6 @@ interface IClassMap {
6666
[className: string]: string;
6767
}
6868

69-
interface ICssModulesOptions {
70-
getJSON(cssFileName: string, json: IClassMap): void;
71-
generateScopeName(name: string): string;
72-
}
73-
74-
type TCssModules = (options: ICssModulesOptions) => TCssModules;
75-
7669
/**
7770
* Generates type files (.d.ts) for Sass/SCSS/CSS files.
7871
*
@@ -128,7 +121,7 @@ export class SassTypingsGenerator extends StringValuesTypingsGenerator {
128121
);
129122

130123
let classMap: IClassMap = {};
131-
const cssModulesClassMapPlugin: postcss.Plugin<TCssModules> = cssModules({
124+
const cssModulesClassMapPlugin: postcss.Plugin = cssModules({
132125
getJSON: (cssFileName: string, json: IClassMap) => {
133126
// This callback will be invoked durint the promise evaluation of the postcss process() function.
134127
classMap = json;
@@ -137,7 +130,7 @@ export class SassTypingsGenerator extends StringValuesTypingsGenerator {
137130
generateScopedName: (name: string) => name
138131
});
139132

140-
await postcss([cssModulesClassMapPlugin]).process(css, { from: filePath });
133+
await postcss.default([cssModulesClassMapPlugin]).process(css, { from: filePath });
141134

142135
if (getCssPaths) {
143136
await Promise.all(
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// The webpack-dev-middleware@5.3.1 project has a phantom dependency on @types/node
2+
// and so "npm install" chooses the "*" latest version. As a result, their index.d.ts
3+
// has a reference to fs.StatSyncFn which is new in @types/node@16. As of this writing
4+
// Node 12 is still LTS so we need to support it.
5+
// Upstream issue: https://github.com/webpack/webpack-dev-middleware/issues/1194
6+
declare module 'fs' {
7+
// eslint-disable-next-line
8+
export type StatSyncFn = any;
9+
}

webpack/set-webpack-public-path-plugin/src/SetPublicPathPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
import { EOL } from 'os';
55
import type * as Webpack from 'webpack';
6-
import type * as Webpack5 from 'webpack5';
76
import type * as Tapable from 'tapable';
87

8+
// Workaround for https://github.com/pnpm/pnpm/issues/4301
9+
import type * as Webpack5 from '@rushstack/heft-webpack5-plugin/node_modules/webpack';
10+
911
import { IInternalOptions, getSetPublicPathCode } from './codeGenerator';
1012

1113
/**
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json"
2+
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
3+
4+
"compilerOptions": {
5+
"types": ["heft-jest", "node"]
6+
}
37
}

0 commit comments

Comments
 (0)