Skip to content

Commit 5a0ea0c

Browse files
authoredMay 10, 2021
fix: missing dependencies (#119)
1 parent 1c7a8a2 commit 5a0ea0c

File tree

9 files changed

+21360
-4517
lines changed

9 files changed

+21360
-4517
lines changed
 

‎.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
run: npm i -g npm
8282

8383
- name: Install dependencies
84-
run: npm ci
84+
run: npm ci --force
8585

8686
- name: Install webpack ${{ matrix.webpack-version }}
8787
run: npm i webpack@${{ matrix.webpack-version }}

‎package-lock.json

+21,253-4,505
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"pretest": "npm run lint",
3232
"test": "npm run test:coverage",
3333
"prepare": "npm run build",
34-
"release": "standard-version",
35-
"defaults": "webpack-defaults"
34+
"release": "standard-version"
3635
},
3736
"files": [
3837
"dist"
@@ -53,7 +52,6 @@
5352
"@babel/preset-env": "^7.12.1",
5453
"@commitlint/cli": "^11.0.0",
5554
"@commitlint/config-conventional": "^11.0.0",
56-
"@webpack-contrib/defaults": "^6.3.0",
5755
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5856
"babel-jest": "^26.6.1",
5957
"babel-loader": "^8.1.0",
@@ -69,16 +67,17 @@
6967
"lint-staged": "^10.5.0",
7068
"lodash": "^4.17.20",
7169
"memfs": "^3.2.0",
72-
"mini-css-extract-plugin": "^1.2.1",
70+
"mini-css-extract-plugin": "^1.6.0",
7371
"nodemon": "^2.0.6",
7472
"npm-run-all": "^4.1.5",
73+
"postcss": "^8.2.14",
74+
"postcss-font-magician": "^3.0.0",
75+
"postcss-loader": "^5.2.0",
7576
"prettier": "^2.1.2",
7677
"sass": "^1.27.0",
7778
"sass-loader": "^11.0.1",
7879
"standard-version": "^9.0.0",
79-
"webpack": "^5.3.0",
80-
"webpack-cli": "^4.1.0",
81-
"webpack-defaults": "^4.0.0"
80+
"webpack": "^5.3.0"
8281
},
8382
"keywords": [
8483
"webpack"

‎src/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ function pitch() {
3636
},
3737
(err, r) => {
3838
if (r) {
39-
r.buildDependencies.forEach((d) => this.addBuildDependency(d));
4039
r.fileDependencies.forEach((d) => this.addDependency(d));
4140
r.contextDependencies.forEach((d) => this.addContextDependency(d));
41+
r.missingDependencies.forEach((d) => this.addMissingDependency(d));
42+
r.buildDependencies.forEach((d) =>
43+
// Compatibility with webpack v4
44+
this.addBuildDependency
45+
? this.addBuildDependency(d)
46+
: this.addDependency(d)
47+
);
4248
}
4349

4450
if (err) {

‎src/worker.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
119119
});
120120
nextQuestionId += 1;
121121
};
122+
122123
const buildDependencies = [];
124+
123125
loaderRunner.runLoaders(
124126
{
125127
loaders: data.loaders,
@@ -252,6 +254,7 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
252254
cacheable,
253255
fileDependencies,
254256
contextDependencies,
257+
missingDependencies,
255258
} = lrResult;
256259
const buffersToSend = [];
257260
const convertedResult =
@@ -283,9 +286,10 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
283286
result: {
284287
result: convertedResult,
285288
cacheable,
286-
buildDependencies,
287289
fileDependencies,
288290
contextDependencies,
291+
missingDependencies,
292+
buildDependencies,
289293
},
290294
data: buffersToSend.map((buffer) => buffer.length),
291295
});

‎test/pitch.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const runGetPoolMock = (error) => {
1616
run: jest.fn((opts, cb) => {
1717
cb(error, {
1818
buildDependencies: [],
19+
missingDependencies: [],
1920
fileDependencies: [],
2021
contextDependencies: [],
2122
result: {},

‎test/sass-loader-example/package-lock.json

+71-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['postcss-font-magician'],
3+
};

‎test/sass-loader-example/webpack.config.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ module.exports = (env) => {
2222
};
2323
if (+env.threads > 0) {
2424
threadLoader.warmup(workerPool, ['babel-loader', 'babel-preset-env']);
25-
threadLoader.warmup(workerPoolSass, ['sass-loader', 'css-loader']);
25+
threadLoader.warmup(workerPoolSass, [
26+
'sass-loader',
27+
'postcss-loader',
28+
'css-loader',
29+
]);
2630
}
2731
return {
2832
mode: 'none',
@@ -53,6 +57,14 @@ module.exports = (env) => {
5357
options: workerPoolSass,
5458
},
5559
'css-loader',
60+
{
61+
loader: 'postcss-loader',
62+
options: {
63+
postcssOptions: {
64+
config: path.resolve(__dirname, './postcss.config.js'),
65+
},
66+
},
67+
},
5668
{ loader: 'sass-loader', options: sassLoaderOptions },
5769
].filter(Boolean),
5870
},

0 commit comments

Comments
 (0)
Please sign in to comment.