@_tc/template-core 0.0.1-bate.15 → 0.0.1-bate.16
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/cjs/bundler/utils.js +26 -2
- package/esm/bundler/utils.js +26 -2
- package/package.json +1 -1
package/cjs/bundler/utils.js
CHANGED
|
@@ -132,15 +132,39 @@ const watchFiles = async (callback) => {
|
|
|
132
132
|
console.log(`watching ${runFEPath}/...`);
|
|
133
133
|
};
|
|
134
134
|
exports.watchFiles = watchFiles;
|
|
135
|
+
const customOutputPlugin = {
|
|
136
|
+
name: "custom-output-paths",
|
|
137
|
+
generateBundle(_, bundle) {
|
|
138
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
139
|
+
if (!fileName.endsWith(".html"))
|
|
140
|
+
continue;
|
|
141
|
+
const baseName = path_1.default.basename(fileName);
|
|
142
|
+
const desiredName = `frontend/${baseName}`;
|
|
143
|
+
delete bundle[fileName];
|
|
144
|
+
chunk.fileName = desiredName;
|
|
145
|
+
bundle[desiredName] = chunk;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
};
|
|
135
149
|
const VBuildFE = async (input) => {
|
|
136
150
|
// 根据入口构建
|
|
137
151
|
await (0, vite_1.build)({
|
|
138
152
|
configFile: false,
|
|
139
|
-
plugins: [
|
|
153
|
+
plugins: [
|
|
154
|
+
(await Promise.resolve().then(() => __importStar(require("@vitejs/plugin-react")))).default(),
|
|
155
|
+
customOutputPlugin,
|
|
156
|
+
],
|
|
140
157
|
build: {
|
|
141
158
|
outDir: outDir(),
|
|
142
159
|
emptyOutDir: true,
|
|
143
|
-
rollupOptions: {
|
|
160
|
+
rollupOptions: {
|
|
161
|
+
input,
|
|
162
|
+
output: {
|
|
163
|
+
entryFileNames: "frontend/[name].js",
|
|
164
|
+
chunkFileNames: "frontend/[name].js",
|
|
165
|
+
assetFileNames: "frontend/[name].[ext]",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
144
168
|
},
|
|
145
169
|
resolve: {
|
|
146
170
|
alias: {
|
package/esm/bundler/utils.js
CHANGED
|
@@ -90,15 +90,39 @@ export const watchFiles = async (callback) => {
|
|
|
90
90
|
});
|
|
91
91
|
console.log(`watching ${runFEPath}/...`);
|
|
92
92
|
};
|
|
93
|
+
const customOutputPlugin = {
|
|
94
|
+
name: "custom-output-paths",
|
|
95
|
+
generateBundle(_, bundle) {
|
|
96
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
97
|
+
if (!fileName.endsWith(".html"))
|
|
98
|
+
continue;
|
|
99
|
+
const baseName = path.basename(fileName);
|
|
100
|
+
const desiredName = `frontend/${baseName}`;
|
|
101
|
+
delete bundle[fileName];
|
|
102
|
+
chunk.fileName = desiredName;
|
|
103
|
+
bundle[desiredName] = chunk;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
};
|
|
93
107
|
export const VBuildFE = async (input) => {
|
|
94
108
|
// 根据入口构建
|
|
95
109
|
await build({
|
|
96
110
|
configFile: false,
|
|
97
|
-
plugins: [
|
|
111
|
+
plugins: [
|
|
112
|
+
(await import("@vitejs/plugin-react")).default(),
|
|
113
|
+
customOutputPlugin,
|
|
114
|
+
],
|
|
98
115
|
build: {
|
|
99
116
|
outDir: outDir(),
|
|
100
117
|
emptyOutDir: true,
|
|
101
|
-
rollupOptions: {
|
|
118
|
+
rollupOptions: {
|
|
119
|
+
input,
|
|
120
|
+
output: {
|
|
121
|
+
entryFileNames: "frontend/[name].js",
|
|
122
|
+
chunkFileNames: "frontend/[name].js",
|
|
123
|
+
assetFileNames: "frontend/[name].[ext]",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
102
126
|
},
|
|
103
127
|
resolve: {
|
|
104
128
|
alias: {
|