Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sdks/web-js-sdk/examples/loadEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
window.ENV = {};
try {
const xhr = new XMLHttpRequest();
xhr.open('GET', '/../.env', false);
xhr.open('GET', '/.env', false);
xhr.send();
if (xhr.status === 200) {
xhr.responseText.split('\n').forEach((line) => {
Expand Down
1 change: 1 addition & 0 deletions packages/sdks/web-js-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"description": "Descope JavaScript web SDK",
"scripts": {
"start": "npm run generateCerts && npx nx run web-js-sdk:build && npm run build && http-server -p 8081 -S -o ./examples",
"dev": "npm run generateCerts && npx nx run web-js-sdk:build && rollup -c rollup.config.serve.mjs -w",
"build": "rimraf dist && rollup -c",
"test": "jest",
"lint": "eslint '+(src|test|examples)/**/*.ts'",
Expand Down
55 changes: 55 additions & 0 deletions packages/sdks/web-js-sdk/rollup.config.serve.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import browsersync from 'rollup-plugin-browsersync';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import fs from 'fs';
import path from 'path';

import packageJson from './package.json' with { type: 'json' };

const plugins = [
replace({
values: {
BUILD_VERSION: JSON.stringify(packageJson.version),
},
preventAssignment: true,
}),
typescript({
tsconfig: './tsconfig.json',
}),
commonjs(),
resolve(),
];

// Build the UMD bundle and serve examples with live reload
export default {
input: './src/index.umd.ts',
output: {
file: 'dist/index.umd.js',
format: 'umd',
sourcemap: true,
name: 'Descope',
inlineDynamicImports: true,
},
plugins: [
...plugins,
browsersync({
server: {
baseDir: '.',
directory: true,
serveStaticOptions: {
dotfiles: 'allow',
},
},
files: ['dist/**/*.js', 'examples/**/*.html', 'examples/**/*.js'],
port: 8081,
https: {
key: './key.pem',
cert: './cert.pem',
},
startPath: '/examples',
notify: false,
}),
],
};
Loading
Loading