Skip to content

Commit e30e578

Browse files
alan-agius4mgechev
authored andcommitted
build: update mini-css-extract-plugin to version 1.0.0
1 parent 3c2da34 commit e30e578

File tree

7 files changed

+22
-38
lines changed

7 files changed

+22
-38
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
"license-checker": "^25.0.0",
173173
"license-checker-webpack-plugin": "0.1.5",
174174
"loader-utils": "2.0.0",
175-
"mini-css-extract-plugin": "0.11.3",
175+
"mini-css-extract-plugin": "1.0.0",
176176
"minimatch": "3.0.4",
177177
"minimist": "^1.2.0",
178178
"ng-packagr": "~11.0.0-next.0",

packages/angular_devkit/build_angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"less-loader": "7.0.2",
4141
"license-webpack-plugin": "2.3.0",
4242
"loader-utils": "2.0.0",
43-
"mini-css-extract-plugin": "0.11.3",
43+
"mini-css-extract-plugin": "1.0.0",
4444
"minimatch": "3.0.4",
4545
"open": "7.3.0",
4646
"ora": "5.1.0",

packages/angular_devkit/build_angular/src/dev-server/hmr_spec.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { DevServerBuilderOutput } from '@angular-devkit/build-angular';
1010
import fetch from 'node-fetch'; // tslint:disable-line:no-implicit-dependencies
1111
import { createArchitect, host } from '../test-utils';
1212

13-
1413
describe('Dev Server Builder hmr', () => {
1514
const target = { project: 'app', target: 'serve' };
1615
let architect: Architect;
@@ -27,17 +26,25 @@ describe('Dev Server Builder hmr', () => {
2726
await Promise.all(runs.map(r => r.stop()));
2827
});
2928

30-
it('adds HMR accept code in all JS bundles', async () => {
29+
it('adds HMR accept code in main JS bundle', async () => {
3130
const run = await architect.scheduleTarget(target, { hmr: true });
3231
runs.push(run);
3332
const output = await run.result as DevServerBuilderOutput;
3433
expect(output.success).toBe(true);
35-
expect(output.baseUrl).toBe('https://localhost:4200/');
34+
expect(output.baseUrl).toBe('http://localhost:4200/');
35+
36+
const response = await fetch('http://localhost:4200/main.js');
37+
expect(await response.text()).toContain('// HMR Accept Code');
38+
}, 30000);
3639

37-
const polyfills = await fetch('https://localhost:4200/polyfills.js');
38-
expect(await polyfills.text()).toContain('ngHmrAccept(module);');
40+
it('adds HMR accept code for CSS in JS bundles', async () => {
41+
const run = await architect.scheduleTarget(target, { hmr: true });
42+
runs.push(run);
43+
const output = await run.result as DevServerBuilderOutput;
44+
expect(output.success).toBe(true);
45+
expect(output.baseUrl).toBe('http://localhost:4200/');
3946

40-
const main = await fetch('https://localhost:4200/main.js');
41-
expect(await main.text()).toContain('ngHmrAccept(module);');
47+
const response = await fetch('http://localhost:4200/styles.js');
48+
expect(await response.text()).toContain('module.hot.accept(undefined, cssReload);');
4249
}, 30000);
4350
});

packages/angular_devkit/build_angular/src/dev-server/index.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import { readTsconfig } from '../utils/read-tsconfig';
3737
import { assertCompatibleAngularVersion } from '../utils/version';
3838
import { getIndexInputFile, getIndexOutputFile } from '../utils/webpack-browser-config';
3939
import { addError, addWarning } from '../utils/webpack-diagnostics';
40-
import { normalizeExtraEntryPoints } from '../webpack/configs';
4140
import { HmrLoader } from '../webpack/plugins/hmr/hmr-loader';
4241
import { IndexHtmlWebpackPlugin } from '../webpack/plugins/index-html-webpack-plugin';
4342
import { createWebpackLoggingCallback } from '../webpack/utils/stats';
@@ -571,26 +570,8 @@ function _addLiveReload(
571570

572571
entryPoints.push(
573572
'webpack/hot/dev-server',
574-
path.join(__dirname, '../webpack/hmr.js'),
575573
);
576574

577-
if (browserOptions.styles?.length) {
578-
// When HMR is enabled we need to add the css paths as part of the entrypoints
579-
// because otherwise no JS bundle will contain the HMR accept code.
580-
const normalizedStyles = normalizeExtraEntryPoints(browserOptions.styles, 'styles')
581-
.map(style => {
582-
let resolvedPath = path.resolve(root, style.input);
583-
if (!existsSync(resolvedPath)) {
584-
try {
585-
resolvedPath = require.resolve(style.input, { paths: [root] });
586-
} catch {}
587-
}
588-
589-
return resolvedPath;
590-
});
591-
entryPoints.push(...normalizedStyles);
592-
}
593-
594575
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
595576

596577
const hmrLoader: webpack.RuleSetRule = {

packages/angular_devkit/build_angular/src/utils/build-options.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export interface BuildOptions {
4646
bundleDependencies?: boolean;
4747
externalDependencies?: string[];
4848
watch?: boolean;
49-
hmr?: boolean;
5049
outputHashing?: string;
5150
poll?: number;
5251
deleteOutputPath?: boolean;

packages/angular_devkit/build_angular/src/webpack/configs/styles.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
235235
buildOptions.extractCss
236236
? {
237237
loader: MiniCssExtractPlugin.loader,
238-
options: {
239-
hmr: buildOptions.hmr,
240-
},
241238
}
242239
: require.resolve('style-loader'),
243240
{

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8069,14 +8069,14 @@ min-indent@^1.0.0:
80698069
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
80708070
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
80718071

8072-
mini-css-extract-plugin@0.11.3:
8073-
version "0.11.3"
8074-
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz#15b0910a7f32e62ffde4a7430cfefbd700724ea6"
8075-
integrity sha512-n9BA8LonkOkW1/zn+IbLPQmovsL0wMb9yx75fMJQZf2X1Zoec9yTZtyMePcyu19wPkmFbzZZA6fLTotpFhQsOA==
8072+
mini-css-extract-plugin@1.0.0:
8073+
version "1.0.0"
8074+
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-1.0.0.tgz#4afb39f3d97b1b92eacb1ac45025416089f831bd"
8075+
integrity sha512-IsmrPv1nkdSUtFCDrAsuv5kg0k/27sLxfXqSz8vLjnbRKrNgoRdQrUNA4MppawvD+GHLkNP6L1P93Bw50ALkbg==
80768076
dependencies:
8077-
loader-utils "^1.1.0"
8077+
loader-utils "^2.0.0"
80788078
normalize-url "1.9.1"
8079-
schema-utils "^1.0.0"
8079+
schema-utils "^3.0.0"
80808080
webpack-sources "^1.1.0"
80818081

80828082
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:

0 commit comments

Comments
 (0)