@moneko/core 3.8.0 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common.js +1 -1
- package/lib/plugin/override-resolve.js +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +1 -1
package/lib/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as
|
|
1
|
+
import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as c}from"./paths.js";import m from"./plugin/add-entry-attribute.js";import u from"./plugin/override-resolve.js";import f from"./plugin/virtual-module.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import v from"./virtual-modules.js";let{AutomaticPrefetchPlugin:k,DefinePlugin:x,SourceMapDevToolPlugin:C,WatchIgnorePlugin:O}=o,$=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${b?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:b,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let P={main:j("@app/entry")};l.polyfill&&Object.assign(P,{"dom-polyfills":[`${p.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?P={main:l.entry}:Object.keys(l.entry)&&Object.assign(P,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let B=l.basename.split("/").filter(Boolean).length,D=`${Array(B).fill("..").join("/")+(B?"/":"")}404.html`,{pathSegmentsToKeep:M=B,path:R=D}=l.fixBrowserRouter||{},A=!1;l.cacheDirectory&&(A={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[c,process.env.NODE_ENV].filter(Boolean).join("-"),version:d});let H=Object.assign({original:l.alias["@"],override:c&&w(c)},l.overrideResolve);export const clientConfig={entry:P,stats:"errors-only",cache:A,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new f(v),new k,...a,l.htmlPluginOption&&new t(n),l.fixBrowserRouter&&new t({filename:R,inject:!1,templateContent:()=>`<html lang="en"><head><title>${n.title}</title><script>const pathKeep = ${M||B};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e($),y&&new m(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new x({"process.env":JSON.stringify(l.env)}),new O({paths:[/\.d\.ts$/]}),l.sourceMap&&new C(l.sourceMap),l.bar&&new r(l.bar),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:b&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new u(H),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e}from"fs";import{relative as t}from"path";import r from"../paths.js";export default class{constructor(e){this.options=e}apply(
|
|
1
|
+
import{existsSync as e}from"fs";import{relative as t}from"path";import r from"../paths.js";export default class{constructor(e){this.options=e}apply(i){let{override:a,original:s}=this.options;if(a&&s){let o=`./${t(r.programPath,s)}`,l=`./${t(r.programPath,a)}`;i.getHook("existing-file").tapAsync("OverrideResolverPlugin",(t,r,p)=>{let n=t.request||t.path;if(n&&n.startsWith(s)&&t.relativePath){let h=n.replace(s,a);if(e(h)){let e=t.relativePath.replace(o,l);return Object.assign(t,{path:h,relativePath:e,__innerRequest_relativePath:e,__innerRequest:e}),i.doResolve("resolved",t,`OverrideResolverPlugin 使用目标模块${a}`,r,p)}}return p()})}}}
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -244,7 +244,7 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
|
244
244
|
* // 将优先使用 src-test 下的文件进行解析
|
|
245
245
|
* const conf = {
|
|
246
246
|
* overrideResolve: {
|
|
247
|
-
* original: resolveProgramPath('src'),
|
|
247
|
+
* original: resolveProgramPath('src'), // 这里可以省略, 默认为 src 目录, 当为组件库时, 默认为 site 目录
|
|
248
248
|
* override: resolveProgramPath('src-test'),
|
|
249
249
|
* }
|
|
250
250
|
* }
|