Support, update to webpack 5 (#3135)

This commit is contained in:
Alexander Skvortsov 2021-10-31 14:21:17 -04:00 committed by GitHub
parent ca575acfbd
commit f6e5c15af9
4 changed files with 770 additions and 6041 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"clsx": "^1.1.1", "clsx": "^1.1.1",
"color-thief-browser": "^2.0.2", "color-thief-browser": "^2.0.2",
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"expose-loader": "^1.0.3", "expose-loader": "^2.0.0",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"jquery.hotkeys": "^0.1.0", "jquery.hotkeys": "^0.1.0",
"mithril": "^2.0.4", "mithril": "^2.0.4",
@ -28,10 +28,10 @@
"bundlewatch": "^0.3.2", "bundlewatch": "^0.3.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"flarum-tsconfig": "^1.0.2", "flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "1.0.0", "flarum-webpack-config": "2.0.0",
"prettier": "^2.4.1", "prettier": "^2.4.1",
"typescript": "^4.4.4", "typescript": "^4.4.4",
"webpack": "^4.46.0", "webpack": "^5.60.0",
"webpack-cli": "^4.9.1", "webpack-cli": "^4.9.1",
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2"
}, },

View File

@ -1,5 +1,5 @@
// Expose jQuery, mithril and dayjs to the window browser object // Expose jQuery, mithril and dayjs to the window browser object
import 'expose-loader?exposes[]=$&exposes[]=jQuery!jquery'; import 'expose-loader?exposes=$,jQuery!jquery';
import 'expose-loader?exposes=m!mithril'; import 'expose-loader?exposes=m!mithril';
import 'expose-loader?exposes=dayjs!dayjs'; import 'expose-loader?exposes=dayjs!dayjs';

View File

@ -179,11 +179,11 @@ class Frontend implements ExtenderInterface
if ($this->js) { if ($this->js) {
$assets->js(function (SourceCollector $sources) use ($moduleName) { $assets->js(function (SourceCollector $sources) use ($moduleName) {
$sources->addString(function () { $sources->addString(function () {
return 'var module={}'; return 'var module={};';
}); });
$sources->addFile($this->js); $sources->addFile($this->js);
$sources->addString(function () use ($moduleName) { $sources->addString(function () use ($moduleName) {
return "flarum.extensions['$moduleName']=module.exports"; return "flarum.extensions['$moduleName']=module.exports;";
}); });
}); });
} }