Skip to content

Commit 13e96a6

Browse files
authored
fix(csp): remove unsafe-eval requirement for Vue3 production builds (#4159)
1 parent 4e69750 commit 13e96a6

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

app/Http/Middleware/DisableCSP.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ public function handle(Request $request, \Closure $next): mixed
6969
*/
7070
private function handleVueJS()
7171
{
72-
// We have to disable unsafe-eval because Livewire requires it...
73-
// So stupid....
74-
config(['secure-headers.csp.script-src.unsafe-eval' => true]);
75-
7672
// if the public/hot file exists, it means that we need to disable CSP completely
7773
// As we will be reloading on the fly the page and Vite has poor CSP support.
7874
if (File::exists(public_path('hot'))) {

resources/js/app.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const langs = import.meta.glob("../../lang/*.json");
4343
* registering components with the application instance so they are ready
4444
* to use in your application's views. An example is included for you.
4545
*/
46-
const app = createApp({});
46+
const app = createApp(AppComponent);
4747
app.config.globalProperties.window = window;
4848
app.use(pinia);
4949
app.use(PrimeVue, {
@@ -64,7 +64,6 @@ app.directive("ripple", Ripple);
6464
app.directive("focustrap", FocusTrap);
6565
app.directive("tooltip", Tooltip);
6666

67-
app.component("App", AppComponent);
6867
app.use(router);
6968
app.use(ToastService);
7069
app.use(ConfirmationService);

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const baseConfig = {
8383
alias: {
8484
// @ts-ignore-next-line
8585
"@": fileURLToPath(new URL("./resources/js/", import.meta.url)),
86-
vue: "vue/dist/vue.esm-bundler.js",
86+
vue: "vue/dist/vue.runtime.esm-bundler.js",
8787
},
8888
},
8989
build: {

vite.embed.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default defineConfig({
1919
resolve: {
2020
alias: {
2121
'@': fileURLToPath(new URL('./resources/js/', import.meta.url)),
22-
vue: 'vue/dist/vue.esm-bundler.js',
22+
vue: 'vue/dist/vue.runtime.esm-bundler.js',
2323
},
2424
},
2525
build: {

0 commit comments

Comments
 (0)