Skip to content

Commit 52f409f

Browse files
committed
webpack 5 updates
1 parent d403ece commit 52f409f

10 files changed

+39
-25
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@
156156
"tsconfig-paths-webpack-plugin": "3.2.0",
157157
"typed-css-modules": "0.3.1",
158158
"umd-compat-loader": "2.1.1",
159-
"webpack": "5.0.0-beta.29",
159+
"webpack": "5.0.0-beta.30",
160160
"webpack-hot-middleware": "2.24.3",
161161
"webpack-manifest-plugin": "3.0.0-rc.0",
162162
"webpack-mild-compile": "3.3.1",
163-
"webpack-pwa-manifest": "3.7.1",
163+
"webpack-pwa-manifest": "4.2.0",
164164
"wrapper-webpack-plugin": "2.0.0"
165165
}
166166
}

src/base.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,12 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
548548
// `file` uses the pattern `loaderPath!filePath`, hence the regex test
549549
noParse: (file: string) => assetsDirPattern.test(file),
550550
rules: removeEmpty([
551+
{
552+
test: /\.m?js/,
553+
resolve: {
554+
fullySpecified: false
555+
}
556+
},
551557
{
552558
test: indexHtmlPattern,
553559
use: {

src/dev.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ function webpackConfig(args: any): webpack.Configuration {
5151
base,
5252
inject: true,
5353
chunks: [entryName],
54-
meta: manifest ? { 'mobile-web-app-capable': 'yes' } : {},
54+
meta: manifest
55+
? {
56+
'mobile-web-app-capable': 'yes'
57+
}
58+
: {},
5559
template: 'src/index.html',
5660
cache: false
5761
}),

src/dist.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ function webpackConfig(args: any): webpack.Configuration {
101101
base,
102102
inject: true,
103103
chunks: [entryName],
104-
meta: manifest ? { 'mobile-web-app-capable': 'yes' } : {},
104+
meta: manifest
105+
? {
106+
'mobile-web-app-capable': 'yes'
107+
}
108+
: {},
105109
template: 'src/index.html',
106110
cache: false
107111
}),
@@ -167,7 +171,7 @@ function webpackConfig(args: any): webpack.Configuration {
167171
config.plugins = config.plugins.map((plugin: any) => {
168172
if (plugin instanceof MiniCssExtractPlugin) {
169173
return new MiniCssExtractPlugin({
170-
filename: args.omitHash ? '[name].bundle.css' : '[name].[contenthash].bundle.css'
174+
filename: args.omitHash ? '[name].bundle.css' : '[name].bundle.css'
171175
});
172176
}
173177
return plugin;
@@ -215,8 +219,8 @@ function webpackConfig(args: any): webpack.Configuration {
215219
config.output = {
216220
...output,
217221
path: outputPath,
218-
chunkFilename: args.omitHash ? '[name].bundle.js' : '[name].[chunkhash].bundle.js',
219-
filename: args.omitHash ? '[name].bundle.js' : '[name].[chunkhash].bundle.js'
222+
chunkFilename: args.omitHash ? '[name].bundle.js' : '[name].bundle.js',
223+
filename: args.omitHash ? '[name].bundle.js' : '[name].bundle.js'
220224
};
221225

222226
return config;

src/schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,10 @@
377377
"strategy": {
378378
"type": "string",
379379
"enum": [
380-
"networkFirst",
381-
"cacheFirst",
382-
"networkOnly",
383-
"staleWhileRevalidate"
380+
"NetworkFirst",
381+
"CacheFirst",
382+
"NetworkOnly",
383+
"StaleWhileRevalidate"
384384
]
385385
},
386386
"expiration": {

test-app/.dojorc-dev-pwa

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"clientsClaim": true,
3636
"excludeBundles": [ "src/LazyWidget" ],
3737
"routes": [
38-
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "cacheFirst", "expiration": { "maxEntries": 25 } },
39-
{ "urlPattern": "/api", "strategy": "networkFirst" }
38+
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "CacheFirst", "expiration": { "maxEntries": 25 } },
39+
{ "urlPattern": "/api", "strategy": "NetworkFirst" }
4040
]
4141
}
4242
},

test-app/.dojorc-dev-pwa-evergreen

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"clientsClaim": true,
3535
"excludeBundles": [ "src/LazyWidget" ],
3636
"routes": [
37-
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "cacheFirst", "expiration": { "maxEntries": 25 } },
38-
{ "urlPattern": "/api", "strategy": "networkFirst" }
37+
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "CacheFirst", "expiration": { "maxEntries": 25 } },
38+
{ "urlPattern": "/api", "strategy": "NetworkFirst" }
3939
]
4040
}
4141
},

test-app/.dojorc-dist-pwa

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"clientsClaim": true,
3535
"excludeBundles": [ "src/LazyWidget" ],
3636
"routes": [
37-
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "cacheFirst", "expiration": { "maxEntries": 25 } },
38-
{ "urlPattern": "/api", "strategy": "networkFirst" }
37+
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "CacheFirst", "expiration": { "maxEntries": 25 } },
38+
{ "urlPattern": "/api", "strategy": "NetworkFirst" }
3939
]
4040
}
4141
},

test-app/.dojorc-dist-pwa-evergreen

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"clientsClaim": true,
3434
"excludeBundles": [ "src/LazyWidget" ],
3535
"routes": [
36-
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "cacheFirst", "expiration": { "maxEntries": 25 } },
37-
{ "urlPattern": "/api", "strategy": "networkFirst" }
36+
{ "urlPattern": "\\.(jpg|png|gif|svg)$", "strategy": "CacheFirst", "expiration": { "maxEntries": 25 } },
37+
{ "urlPattern": "/api", "strategy": "NetworkFirst" }
3838
]
3939
}
4040
},

tests/integration/build.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
describe('build', () => {
22
function testUrl(dir: string, isDist: boolean, isPwa: boolean) {
33
cy.visit(`/test-app/output/${dir}/`);
4-
cy.get('#div').should(
5-
'contain',
6-
`Built with Build Time Render: true
7-
Currently Rendered by BTR: false`
8-
);
94
cy.get('#app-root').should('contain', 'Lazy Widget using dojorc configuration');
105
cy.get('#div').should('have.css', 'background-color', 'rgba(0, 0, 0, 0.5)');
116
cy.get('#vars').should('have.css', 'outline-color', 'rgba(255, 0, 0, 0.5)');
@@ -18,6 +13,11 @@ Currently Rendered by BTR: false`
1813
cy.get('#div[has-prod=prod]').should(isDist ? 'exist' : 'not.exist');
1914
cy.get('#div[dojo-debug=true]').should(isDist ? 'not.exist' : 'exist');
2015
cy.get('#div[has-ci=ci]').should(isDist ? 'not.exist' : 'exist');
16+
cy.get('#div').should(
17+
'contain',
18+
`Built with Build Time Render: true
19+
Currently Rendered by BTR: false`
20+
);
2121

2222
cy.get('meta[name="mobile-web-app-capable"]').should(isPwa ? 'exist' : 'not.exist');
2323
cy.get('meta[name="apple-mobile-web-app-capable"]').should(isPwa ? 'exist' : 'not.exist');
@@ -54,7 +54,7 @@ Currently Rendered by BTR: false`
5454
it('dev-pwa', () => {
5555
testUrl('dev-pwa', false, true);
5656
});
57-
it('dev-app', () => {
57+
it('dev-pwa-evergreen', () => {
5858
testUrl('dev-pwa-evergreen', false, true);
5959
});
6060
});

0 commit comments

Comments
 (0)