rollup-plugin-serve
rollup-plugin-serve copied to clipboard
add major features from webpack-dev-server
- compress
- proxy
- before
- after
- historyApiFallback (object format)
- serveIndex
- headers
The end goal is to make sure it can run react-scripts
config (almost) unmodified
This looks promising, but I don't have the time to review this completely so I hope somebody else can review.
I released the PR as [email protected]
A happy user of [email protected]
here. I'm especially happy about the directory indexes, because I have several development pages in my project and I like to navigate to them in the browser. My configuration:
serve({
open: false,
port: 8080,
+ contentBase: __dirname, // I have rollup config in the project root
+ serveIndex: true,
})
If I don't add the contentBase
, it'll fail:
[!] TypeError: root path required
TypeError: root path required
at Function.serveStatic [as static] (/Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/serve-static/index.js:40:11)
at /Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/rollup-plugin-serve/dist/index.cjs.js:189:58
at Array.forEach (<anonymous>)
at Object.contentBaseFiles (/Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/rollup-plugin-serve/dist/index.cjs.js:188:29)
at /Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/rollup-plugin-serve/dist/index.cjs.js:272:22
at Array.forEach (<anonymous>)
at Object.serve [as default] (/Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/rollup-plugin-serve/dist/index.cjs.js:271:42)
at Object.<anonymous> (/Users/ferdipr/Sources/gitlab/ot-web-components/rollup.config.js:81:46)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.require.extensions.<computed> [as .js] (/Users/ferdipr/Sources/gitlab/ot-web-components/node_modules/rollup/dist/shared/loadConfigFile.js:621:20)
The default contentBase: ''
worked earlier to serve the content of the current directory. You might want to send process.cwd()
to the serve-static
, so that it wouldn't fail with the default configuration right away.
This feature was included in 2.0.0-beta.0, but it didn't make it to 2.0.0. Are there any plans to include it in an upcoming version? Thank you!
2.0.2 was released without this feature. Are you going to accept ii? Or do you want to close this PR and wait for a different one?