Skip to content

Commit 0eb9eca

Browse files
authored
Add banner directive to rollup config (#162)
* Add banner directive to rollup config Issue #161 * Remove redundant rollup config comment
1 parent aaee885 commit 0eb9eca

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.config/rollup.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,29 @@ export default {
3232
* non-builtin CommonJS modules in Node correctly.
3333
*/
3434
interop: 'defaultOnly',
35+
/**
36+
* This is required to prevent the error:
37+
*
38+
* TypeError: createContext only works in Client Components.
39+
* Add the "use client" directive at the top of the file to use it.
40+
*
41+
* -----
42+
*
43+
* Here is the Rollup documentation on `banner`:
44+
* A string to prepend/append to the bundle. You can also
45+
* supply a function that returns a Promise that resolves
46+
* to a string to generate it asynchronously
47+
*
48+
* (Note: banner and footer options will not
49+
* break sourcemaps).
50+
*/
51+
banner: "'use client';",
3552
},
3653
{
3754
dir: 'dist',
3855
format: 'cjs',
3956
exports: 'named',
57+
banner: "'use client';",
4058
},
4159
],
4260
plugins: [

0 commit comments

Comments
 (0)