Skip to content

Commit

Permalink
Replace metafile files with metafile variables for serve tasks (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrdom authored Feb 22, 2024
1 parent 36130c5 commit 5942762
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ object ScalaJSEsbuildElectronPlugin extends AutoPlugin {
| $rendererModuleEntryPointsJsArray,
| $rendererRelativeOutputDirectoryJs,
| 'assets',
| 'sbt-scalajs-esbuild-renderer-bundle-meta.json',
| 8001,
| 8000,
| $htmlEntryPointsJsArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,28 @@ object EsbuildWebScripts {
| entryPoints,
| outDirectory,
| outputFilesDirectory,
| metaFileName,
| serverPort,
| serverProxyPort,
| htmlEntryPoints
|) => {
| const http = require('http');
| const esbuild = require('esbuild');
| const fs = require('fs');
| const path = require('path');
| const EventEmitter = require('events');
|
| const reloadEventEmitter = new EventEmitter();
|
| var meta = null;
|
| const plugins = [{
| name: 'metafile-plugin',
| setup(build) {
| build.onEnd(result => {
| if (!result.metafile) {
| console.warn("Metafile missing in build result")
| fs.writeFileSync(metaFileName, '{}');
| meta = null;
| } else {
| fs.writeFileSync(metaFileName, JSON.stringify(result.metafile));
| meta = result.metafile;
| }
| });
| }
Expand All @@ -161,15 +161,6 @@ object EsbuildWebScripts {
| });
|
| const proxy = http.createServer((req, res) => {
| const metaPath = path.join(__dirname, metaFileName);
| let meta;
| try {
| meta = JSON.parse(fs.readFileSync(metaPath));
| } catch (error) {
| res.writeHead(500);
| res.end('META file ['+metaPath+'] not found');
| }
|
| if (meta) {
| const forwardRequest = (path) => {
| const options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ object ScalaJSEsbuildWebPlugin extends AutoPlugin {
| $entryPointsJsArray,
| $relativeOutputDirectoryJs,
| 'assets',
| 'sbt-scalajs-esbuild-serve-meta.json',
| 8001,
| 8000,
| $htmlEntryPointsJsArray
Expand Down

0 comments on commit 5942762

Please sign in to comment.