Skip to content

Commit 4a8ebe5

Browse files
authored
Merge pull request #617 from CourseOrchestra/webpack
webpack4 -> webpack5
2 parents 019af4b + ecd2490 commit 4a8ebe5

5 files changed

Lines changed: 28 additions & 31 deletions

File tree

src/main/javascript/lyra/.babelrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module.exports = {
22
presets: [['@babel/env']],
33
plugins: [
44
'rewire',
5-
['babel-plugin-istanbul', {
6-
extension: ['.js', '.vue']
7-
}]
5+
['istanbul', {extension: ['.js', '.vue']}]
86
]
97
};

src/main/javascript/lyra/karma.conf.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
process.env.CHROME_BIN = require('puppeteer')
2-
.executablePath();
1+
process.env.CHROME_BIN = require('puppeteer').executablePath();
32
const webpackConfig = require('./webpack.config');
43

54
module.exports = function setConfig(config) {
65
config.set({
7-
frameworks: ['mocha', 'sinon-chai'],
6+
frameworks: ['mocha', 'sinon-chai', 'webpack'],
87

98
preprocessors: {
109
'**/*.spec.js': ['webpack'],
@@ -46,10 +45,9 @@ module.exports = function setConfig(config) {
4645
],
4746
},
4847

49-
singleRun: true,
50-
5148
browserNoActivityTimeout: 900000,
5249

50+
singleRun: true,
5351
browsers: ['ChromeHeadless'],
5452
// browsers: ['Chrome'],
5553

src/main/javascript/lyra/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@
4747
"babel-plugin-rewire": "^1.2.0",
4848
"chai": "^4.3.4",
4949
"css-loader": "^5.2.6",
50-
"dojo-webpack-plugin": "^2.8.19",
50+
"dojo-webpack-plugin": "^3.0.1",
5151
"eslint": "^7.29.0",
5252
"eslint-config-airbnb-base": "^14.2.1",
5353
"eslint-plugin-chai-expect": "^2.2.0",
5454
"eslint-plugin-chai-friendly": "^0.7.1",
5555
"eslint-plugin-import": "^2.23.4",
5656
"eslint-plugin-vue": "^7.12.1",
57-
"file-loader": "^6.2.0",
5857
"karma": "^6.3.4",
5958
"karma-chai": "^0.1.0",
6059
"karma-chrome-launcher": "^3.1.0",
@@ -63,15 +62,16 @@
6362
"karma-sinon": "^1.0.5",
6463
"karma-sinon-chai": "^2.0.2",
6564
"karma-spec-reporter": "^0.0.32",
66-
"karma-webpack": "^4.0.2",
65+
"karma-webpack": "^5.0.0",
6766
"mocha": "^9.0.1",
6867
"puppeteer": "^10.1.0",
6968
"sinon": "^11.1.1",
7069
"sinon-chai": "^3.7.0",
71-
"style-loader": "^2.0.0",
70+
"style-loader": "^3.0.0",
71+
"url-loader": "^4.1.1",
7272
"vue-loader": "^15.9.7",
7373
"vue-template-compiler": "^2.6.14",
74-
"webpack": "^4.46.0"
74+
"webpack": "^5.41.1"
7575
},
7676
"directories": {
7777
"lib": "."

src/main/javascript/lyra/test/unit/LyraGrid.spec.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('LyraGrid.vue', () => {
3838
},
3939
});
4040

41-
setImmediate(() => {
41+
setTimeout(() => {
4242
wrapper.vm.grid.startup();
4343
req.respond(200,
4444
{
@@ -47,7 +47,7 @@ describe('LyraGrid.vue', () => {
4747
},
4848
JSON.stringify(mockData));
4949
done();
50-
});
50+
}, 0);
5151
});
5252
after(() => {
5353
sinon.useFakeXMLHttpRequest()
@@ -224,7 +224,7 @@ describe('LyraGrid.vue', () => {
224224
},
225225
});
226226

227-
setImmediate(() => {
227+
setTimeout(() => {
228228
wrapper.vm.grid.startup();
229229
req.respond(200,
230230
{
@@ -233,7 +233,7 @@ describe('LyraGrid.vue', () => {
233233
},
234234
JSON.stringify(mockData));
235235
done();
236-
});
236+
}, 0);
237237
});
238238
after(() => {
239239
sinon.useFakeXMLHttpRequest()
@@ -318,7 +318,7 @@ describe('LyraGrid.vue', () => {
318318
},
319319
});
320320

321-
setImmediate(() => {
321+
setTimeout(() => {
322322
wrapper.vm.grid.startup();
323323
req.respond(200,
324324
{
@@ -327,7 +327,7 @@ describe('LyraGrid.vue', () => {
327327
},
328328
JSON.stringify(mockData));
329329
done();
330-
});
330+
}, 0);
331331
});
332332
afterEach(() => {
333333
sinon.useFakeXMLHttpRequest()
@@ -568,10 +568,10 @@ describe('LyraGrid.vue', () => {
568568
});
569569

570570
it('lyra grid div not found', (done) => {
571-
setImmediate(() => {
571+
setTimeout(() => {
572572
expect(wrapper.vm.grid).to.be.undefined;
573573
done();
574-
});
574+
}, 0);
575575
});
576576
});
577577

@@ -614,7 +614,7 @@ describe('LyraGrid.vue', () => {
614614
},
615615
});
616616

617-
setImmediate(() => {
617+
setTimeout(() => {
618618
wrapper.vm.grid.startup();
619619
req.respond(200,
620620
{
@@ -623,7 +623,7 @@ describe('LyraGrid.vue', () => {
623623
},
624624
JSON.stringify(mockData));
625625
done();
626-
});
626+
}, 0);
627627
});
628628
after(() => {
629629
sinon.useFakeXMLHttpRequest()
@@ -740,10 +740,10 @@ describe('LyraGrid.vue', () => {
740740
},
741741
});
742742

743-
setImmediate(() => {
743+
setTimeout(() => {
744744
showMessage.should.have.been.calledOnceWith(requestError);
745745
done();
746-
});
746+
}, 0);
747747
});
748748
});
749749

@@ -783,7 +783,7 @@ describe('LyraGrid.vue', () => {
783783
},
784784
});
785785

786-
setImmediate(() => {
786+
setTimeout(() => {
787787
wrapper.vm.grid.startup();
788788
req.respond(200,
789789
{
@@ -792,7 +792,7 @@ describe('LyraGrid.vue', () => {
792792
},
793793
JSON.stringify(mockData));
794794
done();
795-
});
795+
}, 0);
796796
});
797797
afterEach(() => {
798798
sinon.useFakeXMLHttpRequest()

src/main/javascript/lyra/webpack.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ module.exports = {
2424
},
2525
{
2626
test: /\.(png|jpg|gif|svg)$/,
27-
loader: 'file-loader',
28-
options: {
29-
name: '[name].[ext]?[hash]',
30-
},
27+
loader: 'url-loader',
3128
},
3229
],
3330
},
@@ -42,4 +39,8 @@ module.exports = {
4239
}),
4340
],
4441

42+
optimization: {
43+
splitChunks: false,
44+
},
45+
4546
};

0 commit comments

Comments
 (0)