Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add local serve command #2521

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint": "eslint packages/*/src --ext .ts",
"watch": "cross-env NODE_ENV=release BUILD_TYPE=MODULE rollup -cw -m inline",
"watch:umd": "cross-env NODE_ENV=release BUILD_TYPE=UMD rollup -cw -m inline",
"dev": "cross-env NODE_ENV=development BUILD_TYPE=MODULE rollup -cw -m inline",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add serve functionality to match PR objectives.

The PR title mentions adding a local serve command, but the new "dev" script doesn't include any server functionality. Consider utilizing the rollup-plugin-serve package that's already listed in devDependencies.

Here's how to add server functionality:

-    "dev": "cross-env NODE_ENV=development BUILD_TYPE=MODULE rollup -cw -m inline",
+    "dev": "cross-env NODE_ENV=development BUILD_TYPE=MODULE rollup -cw -m inline --config rollup.config.serve.js",

Then create a new rollup.config.serve.js that extends your base config and adds the serve plugin:

import serve from 'rollup-plugin-serve';
import baseConfig from './rollup.config.js';

export default {
  ...baseConfig,
  plugins: [
    ...baseConfig.plugins,
    serve({
      contentBase: 'dist',
      port: 3000
    })
  ]
};

"b:types": "pnpm -r --filter=./packages/* run b:types",
"b:module": "cross-env BUILD_TYPE=MODULE NODE_ENV=release rollup -c",
"b:umd": "cross-env BUILD_TYPE=UMD NODE_ENV=release rollup -c",
Expand Down
Loading