Skip to content

Commit 0995b08

Browse files
authored
Merge pull request #483 from icelam/fix-broken-test
test: adjust optimization settings for test case which have chunks and modules imported
2 parents 2e5376c + 2654a18 commit 0995b08

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="language" content="English"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><title>webpack test</title><script defer="defer">(()=>{var e={377:()=>{console.log("Hello world")}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,o),a.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{"use strict";o(377)})()})();</script></head><body><p>This is minimal code to demonstrate webpack usage</p></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="language" content="English"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><title>webpack test</title><script defer="defer">(()=>{var e={"./__tests__/cases/js-with-import/fixtures/app.js":()=>{console.log("Hello world")}},r={};function t(s){var o=r[s];if(void 0!==o)return o.exports;var a=r[s]={exports:{}};return e[s](a,a.exports,t),a.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var s in r)t.o(r,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{"use strict";t("./__tests__/cases/js-with-import/fixtures/app.js")})()})();</script></head><body><p>This is minimal code to demonstrate webpack usage</p></body></html>

__tests__/cases/js-with-import/webpack.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const config: Configuration = {
1010
path: path.join(__dirname, './dist'),
1111
filename: '[name].js'
1212
},
13+
optimization: {
14+
chunkIds: 'named',
15+
moduleIds: 'named'
16+
},
1317
plugins: [
1418
new HtmlWebpackPlugin({
1519
template: path.resolve(__dirname, './fixtures/index.html')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="language" content="English"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><title>webpack test</title><script defer="defer">(()=>{var e={m:{},u:e=>"test.worker.js",o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p:"./"};e.b=document.baseURI||self.location.href;const t=new Worker(new URL(e.p+e.u(912),e.b));let n;t.onmessage=function(e){n||(n=document.createElement("div"),n.setAttribute("id","result"),document.body.append(n));const t=document.createElement("pre");t.innerHTML=JSON.stringify(e.data),n.append(t)},window.addEventListener("load",(()=>{document.getElementById("button").addEventListener("click",(()=>{t.postMessage({postMessage:!0})}))}))})();</script></head><body><p>This is minimal code to demonstrate webpack usage</p><button id="button">Run Action</button></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="language" content="English"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="minimum-scale=1,initial-scale=1,width=device-width,shrink-to-fit=no"/><title>webpack test</title><script defer="defer">(()=>{var e={m:{},u:e=>e+".js",o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p:"./"};e.b=document.baseURI||self.location.href;const t=new Worker(new URL(e.p+e.u("test.worker"),e.b));let n;t.onmessage=function(e){n||(n=document.createElement("div"),n.setAttribute("id","result"),document.body.append(n));const t=document.createElement("pre");t.innerHTML=JSON.stringify(e.data),n.append(t)},window.addEventListener("load",(()=>{document.getElementById("button").addEventListener("click",(()=>{t.postMessage({postMessage:!0})}))}))})();</script></head><body><p>This is minimal code to demonstrate webpack usage</p><button id="button">Run Action</button></body></html>

__tests__/cases/web-worker/webpack.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const config: Configuration = {
1111
filename: '[name].js',
1212
publicPath: './'
1313
},
14+
optimization: {
15+
chunkIds: 'named',
16+
moduleIds: 'named'
17+
},
1418
plugins: [
1519
new HtmlWebpackPlugin({
1620
template: path.resolve(__dirname, './fixtures/index.html')

0 commit comments

Comments
 (0)