diff options
Diffstat (limited to 'contrib/build-fast-with-linaria.mjs')
-rw-r--r-- | contrib/build-fast-with-linaria.mjs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/build-fast-with-linaria.mjs b/contrib/build-fast-with-linaria.mjs new file mode 100644 index 000000000..88ce75f18 --- /dev/null +++ b/contrib/build-fast-with-linaria.mjs @@ -0,0 +1,42 @@ + +import linaria from '@linaria/esbuild' +import esbuild from 'esbuild' + +if (process.argv.length !== 4) { + console.log(` +Usage: + ${process.argv[1]} <entryPoint> <outDir> + +entryPoint: file to be converted +outputDir: destination directory +`) + process.exit(1) +} + +esbuild + .build({ + entryPoints: [process.argv[2]], + bundle: true, + outdir: process.argv[3], + minify: false, + nodePaths: ['build/web', 'vendor'], + loader: { + '.svg': 'dataurl', + '.png': 'dataurl', + }, + target: [ + 'esnext' + ], + format: 'esm', + jsxFactory: 'h', + jsxFragment: 'Fragment', + define: { + 'process.env.NODE_ENV' : '"development"', + }, + plugins: [ + linaria.default({ + sourceMap: true, + }), + ], + }) + .catch (() => process.exit(1)); |