65 lines
1.8 KiB
JavaScript
65 lines
1.8 KiB
JavaScript
import * as esbuild from 'esbuild';
|
|
|
|
import { sassPlugin } from 'esbuild-sass-plugin';
|
|
// import svgPlugin from 'esbuild-plugin-svg-bundle';
|
|
import svgPlugin from 'esbuild-plugin-svg';
|
|
import { copy } from 'esbuild-plugin-copy';
|
|
// import manifestPlugin from 'esbuild-plugin-manifest';
|
|
import manifestPlugin from 'esbuild-plugin-assets-manifest';
|
|
import copyWithHashPlugin from '@enonic/esbuild-plugin-copy-with-hash';
|
|
import inlineImportPlugin from 'esbuild-plugin-inline-import';
|
|
|
|
const staticDir = './static';
|
|
const wellKnownDir = './well-known';
|
|
|
|
await esbuild.build({
|
|
bundle: true,
|
|
minify: true,
|
|
sourcemap: true,
|
|
entryPoints: {
|
|
main: './frontend/src/main.js',
|
|
polyfill: './frontend/src/polyfill.js',
|
|
},
|
|
outdir: staticDir,
|
|
plugins: [
|
|
sassPlugin(),
|
|
svgPlugin({
|
|
minify: true,
|
|
// bundleFile: `${wellKnownDir}/svg-bundle.svg`,
|
|
// bundleUrl: `${wellKnownDir}/svg-bundle.svg`,
|
|
}),
|
|
copy({
|
|
resolveFrom: 'cwd',
|
|
assets: {
|
|
from: [ './assets/favicons/*' ],
|
|
to: [ `${wellKnownDir}/de-de-formal`, `${wellKnownDir}/en-eu` ],
|
|
},
|
|
}),
|
|
copy({
|
|
resolveFrom: 'cwd',
|
|
assets: {
|
|
from: [ './config/robots.txt' ],
|
|
to: [ `${wellKnownDir}/de-de-formal`, `${wellKnownDir}/en-eu` ],
|
|
},
|
|
}),
|
|
// ...['de-de-formal','en-eu'].map((lang) => manifestPlugin({
|
|
manifestPlugin({
|
|
filename: 'manifest.json',
|
|
path: 'config',
|
|
// metadata: { timestamp: new Date(), module: 'myapp', type: 'esm', },
|
|
processOutput(assets) {
|
|
const orderAssets = {
|
|
main: assets['main'],
|
|
...assets
|
|
};
|
|
return JSON.stringify(orderAssets, null, ' ');
|
|
},
|
|
}),
|
|
/* copyWithHashPlugin({
|
|
patterns: [
|
|
'./assets/favicons/*',
|
|
'./config/robots.txt',
|
|
],
|
|
}), */
|
|
],
|
|
}); |