Closed simonbuehler closed 1 year ago
Try add "enforce: 'post'" in your Plugins like this:
plugins: [
vue(),
{
...obfuscator({}),
enforce: 'post'
}
]
unfortunately this doesn't work and post
only applies to globalOptions
and not fileoptions. globalOptions
doesn't allow to exclude chunks and my aim is to just obfuscate app.js and leave the vendor chunk as is
my config is
build: {
rollupOptions: {
plugins: [
obfuscator({
include :['**/*.js', '**/*.ts', '**/*.vue'],
exclude : ['node_modules/**'],
fileOptions: {
log: true,
},
globalOptions: false,
})
]
},
},
plugins: [
splitVendorChunkPlugin(),
vue(),
{
...obfuscator({}),
enforce: 'post'
},
laravel({
input: [
'resources/sass/app.scss',
'resources/js/app.js',
'resources/js/dashboard.js'], // add scss file
refresh: true,
}),
Hi, I have this error TypeError: obfuscator is not a function
I'm using code like this.
import { fileURLToPath, URL } from 'node:url'
import obfuscator from 'rollup-plugin-obfuscator'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
base: '',
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
outDir: 'chrome/store/app',
rollupOptions: {
output: {
plugins: [obfuscator({})],
},
},
},
})
Can someone tell me how to solve this problem? I only want to obfuscate the JS file of the application, not the dependencies.
@doroved please open another issue, your problem has nothing to do with this issue.
@doroved please open another issue, your problem has nothing to do with this issue.
I created a new issue, but unfortunately there is no reaction
Thanks. Indeed. That's because I haven't had time to look at either of them.
I understand you. I hope you will have time to check the issue soon, because I have not found any working alternatives to your solution
So, the problem here is that javascript-obfuscator
is treating import.meta.glob()
as any other function, and obfuscating it. It's unfortunate that you can't use enforce: 'post'
to run the obfuscation after Vite does its replacement. But there is another trick that I have used (not with Vite though):
/* javascript-obfuscator:disable */
const modules = import.meta.glob('./dir/*.js')
/* javascript-obfuscator:enable */
If that doesn't work, reopen the issue!
Describe the bug hi, thanks for the pulgin!
when i use the plugin in vite and register the components with Glob imports i get
(intermediate value)[z(...)] is not a function
in the source it showsrollup-plugin-obfuscator
and not injavascript-obfuscator
To Reproduce
Package versions:
rollup-plugin-obfuscator
: v0.2.2javascript-obfuscator
: v2.19.1