I recently started investigating Rollup, and I liked what I’ve seen, so now I want to move from Webpack
Except, I can’t figure out how to get Rollup to work with netlify dev
My rollup.config.js
:
import vue from "rollup-plugin-vue2";
import { terser } from "rollup-plugin-terser";
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import scss from "rollup-plugin-scss";
import postcss from "rollup-plugin-postcss";
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";
import json from "@rollup/plugin-json";
const isProduction = !process.env.ROLLUP_WATCH;
export default {
input: "src/main.js",
output: {
file: "dist/bundle.js",
format: "esm",
name: "app"
},
plugins: [
nodeResolve({ browser: true }),
commonjs(),
scss(),
isProduction && postcss(),
json(),
vue(),
isProduction &&
terser({
module: true
}),
!isProduction &&
serve({
contentBase: "dist",
historyApiFallback: true,
port: 8080
}),
!isProduction && livereload("dist")
],
watch: {
clearScreen: true
}
};
With this configuration, running netlify dev
will indeed result in Rollup building the site, starting from main.js
Then, localhost:8888
will open in a new tab, the site will successfully load, yet Functions won’t work (calls return 500 error codes)
Thank you for helping!