Last active
June 5, 2024 20:21
-
-
Save remmel/ff381e4bd6c4ac8ce8355dcd7cf81ba9 to your computer and use it in GitHub Desktop.
cxrjs word main iife build
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
chrome.scripting.registerContentScripts([ | |
{ | |
id: 'XMLOverride', | |
// js: [leboncoin_mainWorld], | |
js: ["build-iife/leboncoinfr_content_worldmain.js"], | |
matches: ["https://www.leboncoin.fr/*"], //also in host_permissions | |
persistAcrossSessions: true, | |
runAt: 'document_start', | |
world: 'MAIN', | |
}, | |
]) |
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
{ | |
web_accessible_resources: [{ | |
"matches": ["https://www.dumb-url-to-force-cxrjs-to-copy.fr/*"], | |
"resources": [ | |
"build-iife/*.js" | |
] | |
}] | |
} |
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
{ | |
"extends": "./tsconfig.json", | |
"compilerOptions": { | |
"noEmit": false, | |
}, | |
"include": ["src"] | |
} |
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
import path from 'path' | |
import { glob } from 'glob' | |
import * as url from 'url' | |
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) | |
const entryFiles = glob.sync(path.join(__dirname, './src/**/*worldmain.*')) | |
// Create an entry object where key is the name and value is the path to the file | |
const entries = entryFiles.reduce((acc, file) => { | |
const name = path.basename(file, path.extname(file)); | |
acc[name] = file; | |
return acc; | |
}, {}); | |
console.log(entryFiles) //, path.resolve(__dirname, 'src')) | |
export default { | |
entry: entries, | |
output: { | |
path: path.resolve('build-iife'), | |
iife: true, | |
}, | |
resolve: { | |
extensions: ['.ts', '.js'], | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.ts$/, | |
// use: 'ts-loader', | |
exclude: /node_modules/, | |
use: [{ | |
loader: 'ts-loader', | |
options: { | |
configFile: "tsconfig.webpack.json" | |
} | |
}] | |
}, | |
], | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will build as iife files
webpack:
/src/**/*worldmain.*
->/build-iife/
(as iife file)vite/cxrjs: copy
build-iife/*.js
->/dist/
Work in dev and build. However, in dev mode webpack changes in ROOT/build-iife are not updated in ROOT/dist/build-iife