Comments (3)
Hey @AliKdhim87!
Thanks for the issue! Do you know if this is a problem without Next.js in the equation? The reproduction feels a bit complicated at the moment, so it would be great if we could strip out some aspects to help isolate the issue!
from stencil.
Hey, @tanner-reits!
I'm able to reproduce this with Angular on a fresh ionic start
project.
I've followed the steps in the documentation, but setNonce()
doesn't seem to work.
Angular correctly provides the nonce to CSP_NONCE
.
Repo: https://github.com/Yudi/csp-nonce-ionic-error/
To reproduce, I set the following:
// package.json
"@ionic/angular": "^8.2.0",
"@ionic/core": "^8.2.0",
<!-- index.html -->
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'nonce-randomNonceGoesHere'; style-src 'self' 'nonce-randomNonceGoesHere'"
/>
// main.ts
import { setNonce } from '@ionic/core/loader';
...
const nonce = 'randomNonceGoesHere';
setNonce(nonce);
bootstrapApplication(AppComponent, {
providers: [
{ provide: CSP_NONCE, useValue: nonce },
...
main.ts
Console output
index.js
plt.$nonce$
is undefined
Therefore nonce
is undefined
from stencil.
@Yudi Changing the import statement in main.ts
for the setNonce
import to the following resolves the errors:
import { setNonce } from '@ionic/core/components';
I believe what you had originally would work if you were using the Ionic Angular module, but since your app is using the standalone components variation, you need to use this altered import. Hope that works!
from stencil.
Related Issues (20)
- bug: Hydrate: serializeShadowRoot: false does not render content of the shadow dom of components. HOT 6
- bug: stencil stats does not give stats.json file if file path specified HOT 1
- bug: Adding style directly to children in customElement is not possible. HOT 3
- bug: can't stop propagation of react synthetic events HOT 1
- feat: Give the ability to stop Stencil from expanding types HOT 3
- bug: project builds failing after upgrading to 4.20.0 HOT 2
- bug: stencil test with `e2e` trigger documentation build HOT 1
- bug: All stencil components are imported in Angular even if only one is called HOT 7
- bug: HOT 4
- bug: Copy operation is not copying the file to a different file name HOT 1
- bug: building project fails after the first build HOT 2
- bug: Missing "beforetoggle" and "toggle" events on `HTMLElement`
- bug/question: ref element validity is not up-to-date on Prop Watch trigger HOT 1
- bug: Copy tasks leads to EBUSY: resource busy or locked on Windows OR flattened structure on Mac HOT 2
- bug: transpile() doesn't resovle css imports to node modules HOT 2
- bug: newly added slots are reordered when the container component's attribute set dynamically HOT 2
- feat: Upgrade Rollup to Latest Version to Improve Performance and Support for Modern JavaScript Features HOT 1
- feat: add @PromiseState decorator
- bug: TypeError: Cannot read properties of undefined (reading 'createHTMLDocument') when using renderToString in NextJS HOT 1
- bug: cannot clone contents of rendered`<template>` elements HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stencil.