build prod
This commit is contained in:
parent
5d15e740fc
commit
3ce3a27e78
@ -5,10 +5,23 @@ import fs from 'node:fs';
|
||||
export default defineConfig(({mode}) => ({
|
||||
plugins: [
|
||||
react(),
|
||||
{
|
||||
name: 'add-nonce-back',
|
||||
transformIndexHtml(html) {
|
||||
const nonce = '**MY_PRETTY_CSP_NONCE**';
|
||||
return html.replace(
|
||||
/<script\s+type="module"\s+crossorigin\s+src="\/autocart\.js"\s*>/,
|
||||
(match) => {
|
||||
return `<script type="module" crossorigin nonce="${nonce}" src="/autocart.js">`;
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
mode === 'production' && {
|
||||
name: 'copy-html-root',
|
||||
closeBundle() {
|
||||
fs.copyFileSync('dist/src/template.html', 'dist/auto_cart.html');
|
||||
fs.copyFileSync('dist/src/template.html', 'auto_cart.html');
|
||||
fs.copyFileSync('dist/autocart.js', 'autocart.js');
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user