How to trigger setup a npm script to build a bundle with rollup?


#1

Hi, I am trying to import this repo into glitch, to do some paired programming:

I tried adding a “start” script as

“start”: “rollup -c”

but it goes into an infinite loop apparently, because of the public/bundle.js being written.

what to do? Is there any documentation around what-triggers-what in the glitch container?


#2

I think your build command is working well, you’ll need to execute it manually from the console each time you want to build.

For the start script, what I see on the package.json file is the command serve, that uses ws to serve the public folder.

Also, seems like you need a higher node version since the app requires v7.6.0 or above.

Here’s a package.json code you can copy and paste to your project to get it running.

{
  "name": "fela-sandbox",
  "version": "1.0.0",
  "description": "use fela and mithril to explore style-as-a-function-of-state",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "rollup -c",
    "serve": "ws --directory public",
    "dev": "rollup -c -w",
    "start": "ws --directory public"
  },
  "author": "Alex G Rice",
  "license": "MIT",
  "dependencies": {
    "fela": "^6.1.3",
    "fela-dom": "^7.0.4",
    "mithril": "^1.1.6"
  },
  "devDependencies": {
    "babel-eslint": "^8.0.3",
    "babel-preset-env": "^1.6.1",
    "eslint": "^4.13.1",
    "eslint-plugin-import": "^2.8.0",
    "local-web-server": "^2.3.0",
    "rimraf": "^2.6.1",
    "rollup": "^0.56.2",
    "rollup-plugin-clean": "^1.0.0",
    "rollup-plugin-commonjs": "^8.2.6",
    "rollup-plugin-copy": "^0.2.3",
    "rollup-plugin-css-porter": "^0.1.2",
    "rollup-plugin-eslint": "^4.0.0",
    "rollup-plugin-filesize": "^1.5.0",
    "rollup-plugin-img": "^1.1.0",
    "rollup-plugin-node-globals": "^1.1.0",
    "rollup-plugin-node-resolve": "^3.0.0",
    "rollup-plugin-replace": "^2.0.0",
    "rollup-plugin-string": "^2.0.2",
    "rollup-plugin-typescript2": "^0.11.1",
    "rollup-plugin-uglify": "^3.0.0",
    "typescript": "^2.7.2"
  },
  "engines": {
    "node": "8.x"
  }
}

#3

thank you @kinduff that is helpful info.