aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/plugins/create-manifest-webpack-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/plugins/create-manifest-webpack-plugin')
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index 330c22f..2c9ab8e 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -1,10 +1,15 @@
-const { sources } = require("webpack");
-const path = require("path");
-
-const { getScriptRuntimeFromType } = webpackRequire("utils/script-runtime");
-const { getFileName } = webpackRequire("utils/build-file");
-const scripts = webpackRequire("utils/scripts");
-const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json");
+import webpack from "webpack";
+import path from "path";
+import fs from "fs";
+
+import { getScriptRuntimeFromType } from "../../utils/script-runtime.js";
+import { getFileName } from "../../utils/build-file.js";
+import scripts from "../../utils/scripts.js";
+const manifest = JSON.parse(
+ fs.readFileSync(
+ path.resolve("config/webpack/plugins/create-manifest-webpack-plugin/manifest-template.json"),
+ ),
+);
class CreateManifestPlugin {
constructor({ sharedModulesImportedCount, injectedSharedModulesImportedCount, sortedSharedModules }) {
@@ -21,7 +26,7 @@ class CreateManifestPlugin {
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
},
assets => {
- manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version;
+ manifest.version = JSON.parse(fs.readFileSync((path.resolve(ROOT_DIR, "package.json")))).version;
manifest.content_scripts = [];
let resources = [];
@@ -101,7 +106,7 @@ class CreateManifestPlugin {
compilation.emitAsset(
"manifest.json",
- new sources.RawSource(
+ new webpack.sources.RawSource(
JSON.stringify(
manifest,
undefined,
@@ -117,4 +122,4 @@ class CreateManifestPlugin {
}
}
-module.exports = CreateManifestPlugin;
+export default CreateManifestPlugin;