wirejs-scripts 3.0.6 → 3.0.8
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/bin.js +14 -12
- package/configs/webpack.config.js +4 -4
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -16,7 +16,7 @@ import { requiresContext, Context, CookieJar } from 'wirejs-resources';
|
|
|
16
16
|
import { prebuildApi } from 'wirejs-resources/internal';
|
|
17
17
|
|
|
18
18
|
const CWD = process.cwd();
|
|
19
|
-
const
|
|
19
|
+
const getWebpackConfig = () => webpackConfigure(process.env, process.argv);
|
|
20
20
|
const [_nodeBinPath, _scriptPath, action] = process.argv;
|
|
21
21
|
const processes = [];
|
|
22
22
|
|
|
@@ -370,13 +370,14 @@ async function compile(watch = false) {
|
|
|
370
370
|
const prebuild = await esbuild.context({
|
|
371
371
|
entryPoints: [`${CWD}/src/**/*.ts`],
|
|
372
372
|
outdir: `${CWD}/pre-dist`,
|
|
373
|
-
bundle:
|
|
373
|
+
bundle: false,
|
|
374
374
|
format: 'esm',
|
|
375
375
|
conditions: ['wirejs:client'],
|
|
376
376
|
});
|
|
377
|
+
await prebuild.rebuild();
|
|
377
378
|
prebuild.watch();
|
|
378
379
|
webpack({
|
|
379
|
-
...
|
|
380
|
+
...getWebpackConfig(),
|
|
380
381
|
mode: 'development',
|
|
381
382
|
watch: true
|
|
382
383
|
}, () => {
|
|
@@ -390,15 +391,16 @@ async function compile(watch = false) {
|
|
|
390
391
|
console.log('Started listening on http://localhost:3000/')
|
|
391
392
|
});
|
|
392
393
|
} else {
|
|
393
|
-
logger.log('
|
|
394
|
+
logger.log('prebundling JS');
|
|
394
395
|
await esbuild.build({
|
|
395
396
|
entryPoints: [`${CWD}/src/**/*.ts`],
|
|
396
397
|
outdir: `${CWD}/pre-dist`,
|
|
397
|
-
bundle:
|
|
398
|
+
bundle: false,
|
|
398
399
|
format: 'esm',
|
|
399
400
|
conditions: ['wirejs:client'],
|
|
400
401
|
});
|
|
401
|
-
|
|
402
|
+
logger.log('starting webpack compiler');
|
|
403
|
+
compiler = webpack(getWebpackConfig());
|
|
402
404
|
compiler.run((err, res) => {
|
|
403
405
|
logger.log('invoking webpack compiler');
|
|
404
406
|
if (err) {
|
|
@@ -425,16 +427,16 @@ const engine = {
|
|
|
425
427
|
async build({ watch = false } = {}) {
|
|
426
428
|
logger.log('build starting');
|
|
427
429
|
|
|
428
|
-
rimraf
|
|
430
|
+
await rimraf('dist');
|
|
429
431
|
logger.log('cleared old dist folder');
|
|
430
432
|
|
|
431
|
-
|
|
432
|
-
logger.log('recreated dist folder');
|
|
433
|
-
|
|
434
|
-
rimraf.sync('pre-dist');
|
|
433
|
+
await rimraf('pre-dist');
|
|
435
434
|
logger.log('cleared old pre-dist folder');
|
|
436
435
|
|
|
437
|
-
fs.
|
|
436
|
+
await fs.promises.mkdir('dist');
|
|
437
|
+
logger.log('recreated dist folder');
|
|
438
|
+
|
|
439
|
+
await fs.promises.mkdir('pre-dist');
|
|
438
440
|
logger.log('recreated pre-dist folder');
|
|
439
441
|
|
|
440
442
|
try {
|
|
@@ -131,9 +131,9 @@ export default (env, argv) => {
|
|
|
131
131
|
devtool = 'eval-cheap-source-map';
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const sources = [`./${SRC}/index.
|
|
135
|
-
.concat(glob.sync(`./${SRC}/ssg/**/*.
|
|
136
|
-
.concat(glob.sync(`./${SRC}/ssr/**/*.
|
|
134
|
+
const sources = [`./${SRC}/index.js`]
|
|
135
|
+
.concat(glob.sync(`./${SRC}/ssg/**/*.js`))
|
|
136
|
+
.concat(glob.sync(`./${SRC}/ssr/**/*.js`))
|
|
137
137
|
;
|
|
138
138
|
|
|
139
139
|
const entry = sources.reduce((files, path) => {
|
|
@@ -205,7 +205,7 @@ export default (env, argv) => {
|
|
|
205
205
|
priority: 10,
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
|
-
from: `./${SRC}/ssg/**/*.
|
|
208
|
+
from: `./${SRC}/ssg/**/*.js`,
|
|
209
209
|
to: distPath({ subpathIn: `${SRC}/ssg`, extensionOut: 'html' }),
|
|
210
210
|
transform: Generated,
|
|
211
211
|
noErrorOnMissing: true,
|