Skip to content

Commit f42451c

Browse files
committed
fix: resolve local demo runtime errors and improve documentation
- Add missing REACT_APP_NETLIFY_BASE_URL replacement in rollup config to fix "process is not defined" error in standalone build - Update README CDN example to use specific version (2.4.0) instead of vague @2.x - Document build directory structure and shadow DOM CSS import requirements - Clarify why both /dist/ and /build/ directories are published to npm Fixes local demo functionality where netlifyBaseUrl environment variable was undefined in browser, causing API requests to fail.
1 parent 2851b03 commit f42451c

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function MyApp() {
154154
### Standalone Javascript
155155
156156
```html
157-
<script src="https://unpkg.com/@snf/access-qa-bot@2.x/dist/access-qa-bot.standalone.js"></script>
157+
<script src="https://unpkg.com/@snf/access-qa-bot@2.4.0/dist/access-qa-bot.standalone.js"></script>
158158

159159
<div id="qa-bot"></div>
160160

@@ -254,6 +254,22 @@ This creates the distribution files in the `dist/` directory:
254254
- `access-qa-bot.umd.cjs` (UMD/CommonJS)
255255
- `access-qa-bot.standalone.js` (Standalone version)
256256
257+
### Build Directory
258+
259+
The package includes both `/dist/` and `/build/` directories:
260+
261+
- **`/dist/`**: Library files for npm consumers and CDN usage
262+
- `access-qa-bot.js` (ES module for React apps)
263+
- `access-qa-bot.umd.cjs` (CommonJS)
264+
- `access-qa-bot.standalone.js` (Self-contained for plain HTML)
265+
266+
- **`/build/`**: React app build files
267+
- Required for shadow DOM implementations that need to import CSS directly
268+
- Example: `import qaStyle from '@snf/access-qa-bot/build/static/css/main.css?inline'`
269+
- Maintained for backward compatibility with existing integrations
270+
271+
Both directories are published to npm to support different integration patterns.
272+
257273
### NPM Beta Release
258274
259275
To release a beta version:
@@ -380,7 +396,7 @@ npm install @snf/access-qa-bot@beta
380396
- Removed unused helper functions (`getCurrentPriority`, `getCurrentAccessId`)
381397
- Cleaned up debug console statements for production
382398
- Added markdown renderer plugin alongside HTML renderer
383-
- Improved build configuration and excluded build directory from version control
399+
- Improved build configuration and updated build directory handling
384400
385401
#### 📚 Documentation
386402
- Updated README with comprehensive feature list and integration examples

rollup.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ export default [
7979
preventAssignment: true,
8080
'process.env.NODE_ENV': JSON.stringify('production'),
8181
// Replace react app environment variables
82-
'process.env.REACT_APP_API_KEY': JSON.stringify('demo-key')
82+
'process.env.REACT_APP_API_KEY': JSON.stringify('demo-key'),
83+
'process.env.REACT_APP_NETLIFY_BASE_URL': JSON.stringify('https://access-jsm-api.netlify.app')
8384
}),
8485
resolve({
8586
extensions: ['.js', '.jsx'],

0 commit comments

Comments
 (0)