Niedzielski has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/374919 )
Change subject: Chore: convert Webpack configuration to TypeScript
......................................................................
Chore: convert Webpack configuration to TypeScript
Change-Id: Ib4085cc6780e7c7bbabe2e97c2af943472216e1f
---
M package-lock.json
M package.json
R webpack.config.ts
3 files changed, 33 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/19/374919/1
diff --git a/package-lock.json b/package-lock.json
index 5e46a5e..bb7dd26 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -32,6 +32,15 @@
"@types/node": "8.0.24"
}
},
+ "@types/extract-text-webpack-plugin": {
+ "version": "2.1.0",
+ "resolved":
"https://registry.npmjs.org/@types/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.1.0.tgz",
+ "integrity": "sha1-2w64WdG2HqXSoLda00tP8xehg3k=",
+ "dev": true,
+ "requires": {
+ "@types/webpack": "3.0.9"
+ }
+ },
"@types/mime": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.1.tgz",
diff --git a/package.json b/package.json
index 580b676..d7a1462 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"devDependencies": {
"@types/assets-webpack-plugin": "^3.5.0",
"@types/express": "^4.0.36",
+ "@types/extract-text-webpack-plugin": "^2.1.0",
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.20",
"@types/touch": "^3.1.0",
diff --git a/webpack.config.js b/webpack.config.ts
similarity index 79%
rename from webpack.config.js
rename to webpack.config.ts
index d496471..0bb11f2 100644
--- a/webpack.config.js
+++ b/webpack.config.ts
@@ -1,7 +1,8 @@
/* eslint-env node */
-const path = require("path");
-const AssetsPlugin = require("assets-webpack-plugin");
-const ExtractTextPlugin = require("extract-text-webpack-plugin");
+import * as AssetsPlugin from "assets-webpack-plugin";
+import * as ExtractTextPlugin from "extract-text-webpack-plugin";
+import * as path from "path";
+import * as webpack from "webpack";
const isProd = process.env.NODE_ENV === "production";
const isVerbose = Boolean(JSON.parse(process.env.VERBOSE || "false"));
@@ -15,24 +16,19 @@
// There is no builtin Stats "warnings" preset.
// https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L886
// https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L101-L131
-const STATS = isVerbose
- ? {
- all: true
- }
- : {
- all: false, // Default all options to false.
- errors: true,
- errorDetails: true,
- moduleTrace: true,
- warnings: true
- };
+const stats = {
+ all: isVerbose, // Default all outputs to verbosity.
+ errors: true,
+ errorDetails: true,
+ warnings: true
+};
-module.exports = {
+const configuration: webpack.Configuration = {
entry: {
index: "./src/client/index"
},
- stats: STATS,
+ stats,
output: {
path: paths.client.output,
@@ -90,20 +86,20 @@
// browser.
overlay: { warnings: true, errors: true },
- stats: STATS
- },
-
- plugins: [
- new ExtractTextPlugin({
- filename: isProd ? "[name].[contenthash].css" : "[name].css"
- })
- ]
+ stats
+ }
};
+
+configuration.plugins = [
+ new ExtractTextPlugin({
+ filename: isProd ? "[name].[contenthash].css" : "[name].css"
+ })
+];
if (isProd) {
// Generate a json manifest with the entry points and assets names to use
// in the server to pass to the HTML page template
- module.exports.plugins.push(
+ configuration.plugins.push(
new AssetsPlugin({
prettyPrint: true,
filename: "assets-manifest.json",
@@ -111,3 +107,5 @@
})
);
}
+
+export default configuration;
--
To view, visit https://gerrit.wikimedia.org/r/374919
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4085cc6780e7c7bbabe2e97c2af943472216e1f
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits