-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental (in-progress) setup with ESBuild instead of Webpack
- Loading branch information
Showing
12 changed files
with
879 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,9 @@ typings/ | |
.env | ||
|
||
dist/ | ||
dist_esbuild/* | ||
!dist_esbuild/.keep | ||
!dist_esbuild/app.html | ||
cache/ | ||
build/ | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
http-equiv="Content-Security-Policy" | ||
content="default-src 'none'; img-src 'self' data:; media-src 'self'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://api.github.com; font-src 'self' data:" | ||
/> | ||
<title>Museeks</title> | ||
</head> | ||
|
||
<body> | ||
<div id="wrap"> | ||
<!-- Here goes black magic --> | ||
</div> | ||
</body> | ||
|
||
<script src="./renderer.js" /> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import esbuild from 'esbuild'; | ||
import cssModulesPlugin from 'esbuild-css-modules-plugin'; | ||
import postCssPlugin from 'esbuild-plugin-postcss2'; | ||
import esbuildPluginSvg from 'esbuild-plugin-svg'; | ||
// import htmlPlugin from '@chialab/esbuild-plugin-html'; | ||
|
||
import postCssImport from 'postcss-import'; | ||
import postCssNested from 'postcss-nested'; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Main process build | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ['./src/main/main.ts'], | ||
bundle: true, | ||
outfile: 'dist_esbuild/main.mjs', | ||
platform: 'node', | ||
target: 'node16.5', | ||
external: ['electron'], | ||
minify: true, | ||
}) | ||
.then(() => { | ||
console.log('===== Main bundle built ====='); | ||
}) | ||
.catch(() => process.exit(1)); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Renderer process build | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ['./src/renderer/main.tsx'], | ||
// entryPoints: ['./src/renderer/app.html'], | ||
bundle: true, | ||
outfile: 'dist_esbuild/renderer.js', | ||
platform: 'browser', | ||
target: 'chrome91', | ||
external: ['electron', 'fs', 'stream', 'path', 'platform', 'assert', 'os', 'constants'], | ||
minify: true, | ||
plugins: [ | ||
// htmlPlugin(), | ||
esbuildPluginSvg(), | ||
postCssPlugin.default({ | ||
plugins: [postCssImport, postCssNested], | ||
}), | ||
cssModulesPlugin({ | ||
inject: true, | ||
localsConvention: 'dashesOnly', | ||
v2: true, | ||
}), | ||
], | ||
}) | ||
.then(() => { | ||
console.log('===== Renderer bundle built ====='); | ||
}) | ||
.catch(() => process.exit(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.