fix: build file
This commit is contained in:
parent
2f1702f5a4
commit
ad93bfa6c6
1 changed files with 78 additions and 78 deletions
|
|
@ -28,84 +28,84 @@ let context = null;
|
||||||
|
|
||||||
/** @type {import("esbuild").BuildOptions} */
|
/** @type {import("esbuild").BuildOptions} */
|
||||||
const config = {
|
const config = {
|
||||||
entryPoints: ["src/entry.ts"],
|
entryPoints: ["src/entry.ts"],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
outfile: "dist/kettu.js",
|
outfile: "dist/shiggycord.js",
|
||||||
format: "iife",
|
format: "iife",
|
||||||
splitting: false,
|
splitting: false,
|
||||||
external: [],
|
// Enable minification by default for release builds (when a release-branch is provided).
|
||||||
supported: {
|
// This keeps development builds unminified for easier debugging.
|
||||||
// Hermes does not actually support const and let, even though it syntactically
|
minify: true,
|
||||||
// accepts it, but it's treated just like 'var' and causes issues
|
external: [],
|
||||||
"const-and-let": false
|
supported: {
|
||||||
},
|
// Hermes does not actually support const and let, even though it syntactically
|
||||||
footer: {
|
// accepts it, but it's treated just like 'var' and causes issues
|
||||||
js: "//# sourceURL=kettu"
|
"const-and-let": false,
|
||||||
},
|
},
|
||||||
loader: {
|
loader: {
|
||||||
".png": "dataurl",
|
".png": "dataurl",
|
||||||
".html": "text"
|
".html": "text",
|
||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
window: "globalThis",
|
window: "globalThis",
|
||||||
__DEV__: JSON.stringify(releaseBranch !== "main")
|
__DEV__: JSON.stringify(releaseBranch !== "main"),
|
||||||
},
|
},
|
||||||
inject: ["./shims/asyncIteratorSymbol.js", "./shims/promiseAllSettled.js"],
|
inject: ["./shims/asyncIteratorSymbol.js", "./shims/promiseAllSettled.js", "./shims/weakref.js"],
|
||||||
legalComments: "none",
|
legalComments: "none",
|
||||||
alias: {
|
alias: {
|
||||||
"!kettu-deps-shim!": "./shims/depsModule.ts",
|
"!ShiggyCord-deps-shim!": "./shims/depsModule.ts",
|
||||||
"spitroast": "./node_modules/spitroast",
|
spitroast: "./node_modules/spitroast",
|
||||||
"react/jsx-runtime": "./shims/jsxRuntime"
|
"react/jsx-runtime": "./shims/jsxRuntime",
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
globalPlugin({
|
globalPlugin({
|
||||||
...metroDeps.reduce((obj, key) => {
|
...metroDeps.reduce((obj, key) => {
|
||||||
obj[key] = `require("!kettu-deps-shim!")[${JSON.stringify(key)}]`;
|
obj[key] = `require("!ShiggyCord-deps-shim!")[${JSON.stringify(key)}]`;
|
||||||
return obj;
|
return obj;
|
||||||
}, {})
|
}, {}),
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: "swc",
|
name: "swc",
|
||||||
setup(build) {
|
setup(build) {
|
||||||
build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async args => {
|
build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
|
||||||
const result = await swc.transformFile(args.path, {
|
const result = await swc.transformFile(args.path, {
|
||||||
jsc: {
|
jsc: {
|
||||||
externalHelpers: true,
|
externalHelpers: true,
|
||||||
transform: {
|
transform: {
|
||||||
constModules: {
|
constModules: {
|
||||||
globals: {
|
globals: {
|
||||||
"bunny-build-info": {
|
"bunny-build-info": {
|
||||||
version: `"v1.4.2"`
|
version: `"1.4.1.2"`,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
react: {
|
react: {
|
||||||
runtime: "automatic"
|
runtime: "automatic",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// https://github.com/facebook/hermes/blob/3815fec63d1a6667ca3195160d6e12fee6a0d8d5/doc/Features.md
|
// https://github.com/facebook/hermes/blob/3815fec63d1a6667ca3195160d6e12fee6a0d8d5/doc/Features.md
|
||||||
// https://github.com/facebook/hermes/issues/696#issuecomment-1396235791
|
// https://github.com/facebook/hermes/issues/696#issuecomment-1396235791
|
||||||
env: {
|
env: {
|
||||||
targets: "fully supports es6",
|
targets: "fully supports es6",
|
||||||
include: [
|
include: [
|
||||||
"transform-block-scoping",
|
"transform-block-scoping",
|
||||||
"transform-classes",
|
"transform-classes",
|
||||||
"transform-async-to-generator",
|
"transform-async-to-generator",
|
||||||
"transform-async-generator-functions"
|
"transform-async-generator-functions",
|
||||||
],
|
],
|
||||||
exclude: [
|
exclude: [
|
||||||
"transform-parameters",
|
"transform-parameters",
|
||||||
"transform-template-literals",
|
"transform-template-literals",
|
||||||
"transform-exponentiation-operator",
|
"transform-exponentiation-operator",
|
||||||
"transform-named-capturing-groups-regex",
|
"transform-named-capturing-groups-regex",
|
||||||
"transform-nullish-coalescing-operator",
|
"transform-nullish-coalescing-operator",
|
||||||
"transform-object-rest-spread",
|
"transform-object-rest-spread",
|
||||||
"transform-optional-chaining",
|
"transform-optional-chaining",
|
||||||
"transform-logical-assignment-operators"
|
"transform-logical-assignment-operators",
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return { contents: result.code };
|
return { contents: result.code };
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue