File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
// This code runs on the browser.
2
2
// The options.target is provided from shadow-portal.tsx file.
3
3
function insertIntoTarget ( element , options ) {
4
- var root =
5
- options . target ||
6
- document . querySelector ( 'script[data-nextjs-dev-overlay] > nextjs-portal' )
7
- . shadowRoot
4
+ var root = options . target
8
5
6
+ if ( ! root ) {
7
+ var portal = [ ] . slice
8
+ . call ( document . querySelectorAll ( 'nextjs-portal' ) )
9
+ . find ( ( p ) => p . shadowRoot . querySelector ( '[data-nextjs-toast]' ) )
10
+
11
+ root = portal ?. shadowRoot
12
+ }
13
+
14
+ if ( ! root ) {
15
+ // Don't spam the error overlay with internal message that the user can't control.
16
+ console . log (
17
+ '[Next.js DevTools] No shadow root found to apply Tailwind CSS. This is a bug in Next.js.'
18
+ )
19
+ return
20
+ }
21
+
22
+ // To better indicate the style tag.
23
+ element . setAttribute ( 'data-nextjs-tailwind-style-tag' , '' )
9
24
root . insertBefore ( element , root . firstChild )
10
25
}
11
26
You can’t perform that action at this time.
0 commit comments