|
@@ -0,0 +1,31 @@
|
|
|
+#!/usr/bin/env node
|
|
|
+const swc = require('@swc/core')
|
|
|
+const fs = require('fs');
|
|
|
+const path = require('path');
|
|
|
+const jsdom = require("jsdom");
|
|
|
+const { JSDOM } = jsdom;
|
|
|
+
|
|
|
+const indexJS = fs.readFileSync("./server/public/index.js", 'utf-8');
|
|
|
+const indexHTML = fs.readFileSync("./server/public/index.html", 'utf-8');
|
|
|
+let productionCode = '';
|
|
|
+
|
|
|
+swc.transform(indexJS, {
|
|
|
+ // Some options cannot be specified in .swcrc
|
|
|
+ filename: "index.js",
|
|
|
+ sourceMaps: true,
|
|
|
+ // Input files are treated as module by default.
|
|
|
+ isModule: false,
|
|
|
+
|
|
|
+ // All options below can be configured via .swcrc
|
|
|
+ jsc: {
|
|
|
+ parser: {
|
|
|
+ syntax: "ecmascript",
|
|
|
+ },
|
|
|
+ transform: {},
|
|
|
+ },
|
|
|
+}).then((output) => {
|
|
|
+ productionCode = output.code;
|
|
|
+ // console.log(output.map); // source map (in string)
|
|
|
+}).then(() => {
|
|
|
+
|
|
|
+});
|