File tree Expand file tree Collapse file tree 8 files changed +78
-0
lines changed Expand file tree Collapse file tree 8 files changed +78
-0
lines changed Original file line number Diff line number Diff line change 1+ # amd
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 " />
5+ < title > amd</ title >
6+ </ head >
7+ < body >
8+ < script src ="node_modules/requirejs/require.js "> </ script >
9+ < script type ="text/javascript ">
10+ requirejs (
11+ [ 'plugin/dist/js/plugin.js' ] ,
12+ ( plugin ) => {
13+ console . log ( 'Plugin loaded' , plugin ( ) )
14+ } ,
15+ ( err ) => {
16+ console . error ( 'Error loading plugin' , err )
17+ } ,
18+ )
19+ </ script >
20+ </ body >
21+ </ html >
Original file line number Diff line number Diff line change 1+ {
2+ "scripts" : {
3+ "build" : " pnpm run -r build"
4+ },
5+ "dependencies" : {
6+ "requirejs" : " ^2.3.7"
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ < html />
Original file line number Diff line number Diff line change 1+ import workerUrl from './worker?url&no-inline'
2+
3+ export default function pluginMain ( ) {
4+ console . log ( 'workerUrl' , workerUrl )
5+ return 'OK'
6+ }
Original file line number Diff line number Diff line change 1+ {
2+ "scripts" : {
3+ "build" : " vite build"
4+ }
5+ }
Original file line number Diff line number Diff line change 1+ import { join } from 'node:path'
2+ import { defineConfig } from 'vite'
3+
4+ export default defineConfig ( ( config ) => {
5+ const isProduction = false // config.mode === 'production'
6+ return {
7+ base : './' ,
8+ build : {
9+ outDir : './dist' ,
10+ minify : isProduction ,
11+ rollupOptions : {
12+ preserveEntrySignatures : 'strict' ,
13+ input : {
14+ plugin : './index.ts' ,
15+ } ,
16+ output : {
17+ format : 'amd' ,
18+ assetFileNames : join (
19+ 'assets' ,
20+ `[name]${ isProduction ? '-[hash]' : '' } [extname]` ,
21+ ) ,
22+ chunkFileNames : join (
23+ 'js' ,
24+ 'chunks' ,
25+ `[name]${ isProduction ? '-[hash]' : '' } .mjs` ,
26+ ) ,
27+ entryFileNames : join (
28+ 'js' ,
29+ `[name]${ isProduction ? '-[hash]' : '' } .js` ,
30+ ) ,
31+ } ,
32+ } ,
33+ } ,
34+ }
35+ } )
Original file line number Diff line number Diff line change 1+ console . log ( "I'm a worker" )
You can’t perform that action at this time.
0 commit comments