From 0eb9eca1778525cf126c50e75c13aa388b9312e1 Mon Sep 17 00:00:00 2001 From: Dalton Craven Date: Wed, 8 Feb 2023 09:04:21 -0500 Subject: [PATCH] Add banner directive to rollup config (#162) * Add banner directive to rollup config Issue #161 * Remove redundant rollup config comment --- .config/rollup.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.config/rollup.config.js b/.config/rollup.config.js index 71ead2f..91c0f15 100644 --- a/.config/rollup.config.js +++ b/.config/rollup.config.js @@ -32,11 +32,29 @@ export default { * non-builtin CommonJS modules in Node correctly. */ interop: 'defaultOnly', + /** + * This is required to prevent the error: + * + * TypeError: createContext only works in Client Components. + * Add the "use client" directive at the top of the file to use it. + * + * ----- + * + * Here is the Rollup documentation on `banner`: + * A string to prepend/append to the bundle. You can also + * supply a function that returns a Promise that resolves + * to a string to generate it asynchronously + * + * (Note: banner and footer options will not + * break sourcemaps). + */ + banner: "'use client';", }, { dir: 'dist', format: 'cjs', exports: 'named', + banner: "'use client';", }, ], plugins: [