diff --git a/config/loader.ts b/config/loader.ts index 35e3ec3..e3b310e 100644 --- a/config/loader.ts +++ b/config/loader.ts @@ -1,7 +1,7 @@ import { ExtensionLoadError } from "@framework/exceptions"; type LoaderConfig = import("@framework/internal").LoaderConfig; const config: LoaderConfig = { - target: import("@samples/py/extension"), + target: import("@src/extension"), errorCatches: [Error, ExtensionLoadError], platform: ["TurboWarp"] }; diff --git a/config/test.js b/config/test.js new file mode 100644 index 0000000..6713522 --- /dev/null +++ b/config/test.js @@ -0,0 +1,3 @@ +const { merge } = require("webpack-merge"); +merge({ +}); \ No newline at end of file diff --git a/config/webpack.js b/config/webpack.js index 4fba877..2120b69 100644 --- a/config/webpack.js +++ b/config/webpack.js @@ -11,7 +11,7 @@ const loaderRule = [ { test: /\.ts$/i, use: "ts-loader", - exclude: /\.d\.ts$/i + // exclude: /\.d\.ts$/i }, { test: /\.(html|md)$/i, @@ -44,6 +44,6 @@ const devServer = { * @type {import("webpack").Configuration} */ const staticShow = { - stats: "errors-only" + stats: "normal" }; module.exports = { loaderRule, alias, fileExtensions, devServer, staticShow }; \ No newline at end of file diff --git a/package.json b/package.json index f7992bb..0f332ac 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "webpack": "^5.96.1", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.1.0", + "webpack-merge": "^6.0.1", "webpackbar": "^7.0.0" }, "dependencies": { diff --git a/src/fs-context/entry.ts b/src/fs-context/entry.ts index a0fb634..98a599f 100644 --- a/src/fs-context/entry.ts +++ b/src/fs-context/entry.ts @@ -1,6 +1,7 @@ import { Extensions } from "."; +import type { ScratchWaterBoxed } from "@framework/internal"; export default async function load() { - const currentScratch = Extensions.getScratch() as import("@framework/internal").ScratchWaterBoxed; + const currentScratch = Extensions.getScratch() as ScratchWaterBoxed; if (currentScratch) { const loaderConfig = Extensions.config.loader; const { default: target } = await loaderConfig.target; diff --git a/src/fs-context/index.ts b/src/fs-context/index.ts index 6ee00e4..26372a1 100644 --- a/src/fs-context/index.ts +++ b/src/fs-context/index.ts @@ -1,7 +1,7 @@ import { ExtensionLoadError, UncognizedError } from "./exceptions"; import { ArgumentPlain, BlockPlain, ExtensionPlain, GlobalResourceMachine, HexColorString, LoaderConfig, MenuPlain, ObjectInclude, PlatformSupported, Scratch, ScratchWaterBoxed } from "./internal"; -import { Extension } from "./structs"; import loaderConfig from "@config/loader"; +import type { Extension } from "./structs"; if (!window._FSContext) { // 这个判断有点史,优化下 window._FSContext = { diff --git a/webpack.config.ext.js b/webpack.config.ext.js index b25925a..0092992 100644 --- a/webpack.config.ext.js +++ b/webpack.config.ext.js @@ -11,11 +11,9 @@ module.exports = { entry: "@framework/entry.ts", output: { // filename: `${serverConfig.extension.output}.dist.js`, - filename:"[name].dist.js", + filename: "[name].dist.js", path: path.resolve(__dirname, `dist/${serverConfig.extension.output}`), - clean: true, - library: serverConfig.extension.output, - libraryTarget: "window" + clean: true }, module: { rules: [ @@ -53,5 +51,11 @@ module.exports = { hot: false, liveReload: false, webSocketServer: false + }, + optimization: { + splitChunks: { + chunks: "initial" + }, + runtimeChunk: false } }; \ No newline at end of file