Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

require disappears #181

@timdp

Description

@timdp

Code:

import raf from 'raf'

raf()

Where node_modules/raf/index.js starts with:

var now = require('performance-now')
  , root = typeof window === 'undefined' ? global : window

Rollup config:

import commonjs from 'rollup-plugin-commonjs'
import nodeResolve from 'rollup-plugin-node-resolve'

export default {
  entry: 'main.js',
  dest: 'bundle.js',
  format: 'iife',
  plugins: [
    nodeResolve(),
    commonjs()
  ]
}

Versions:

  "devDependencies": {
    "rollup": "^0.41.5",
    "rollup-plugin-commonjs": "^8.0.1",
    "rollup-plugin-node-resolve": "^2.0.0"
  }

Output of rollup -c rollup.config.js:

🚨   Unexpected token
node_modules/raf/index.js (6:2)
4: 
5: var 
6:   , root = typeof window === 'undefined' ? commonjsHelpers.commonjsGlobal : window
     ^
7:   , vendors = ['moz', 'webkit']
8:   , suffix = 'AnimationFrame'

So it looks like it's stripping out the require('performance-now') but neglecting to remove the comma that follows it?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions