Skip to content

Instantly share code, notes, and snippets.

@kirbysayshi
Last active January 9, 2018 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirbysayshi/6dad0368e4dde7ecac937f68e9a4b8bd to your computer and use it in GitHub Desktop.
Save kirbysayshi/6dad0368e4dde7ecac937f68e9a4b8bd to your computer and use it in GitHub Desktop.
testcast demonstrating rollup getting confused by the presence of "default" as a normal property.
node_modules
dist
package-lock.json
import * as $protobuf from "protobufjs/minimal";
// This causes the following error:
// [!] Error: Cannot split a chunk that has already been edited (2:58 – "$protobuf.roots["default"]")
// Error: Cannot split a chunk that has already been edited (2:58 – "$protobuf.roots["default"]")
// at MagicString$1._splitChunk (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:5250:10)
// at MagicString$1._split (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:5239:51)
// at MagicString$1.overwrite (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:5052:8)
// at Node.MemberExpression.render (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:13334:18)
// at /private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:11347:56
// at /private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:11215:17
// at Array.forEach (<anonymous>)
// at Node.eachChild (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:11207:19)
// at Node.render (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:11347:14)
// at Node.MemberExpression.render (/private/tmp/rollup-protobuf-testcase/node_modules/rollup/dist/rollup.js:13339:33)
const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
export const com = {}
{
"name": "rollup-protobuf-testcase",
"version": "0.0.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"scripts": {
"rollup": "rollup -c"
},
"license": "UNLICENSED",
"devDependencies": {
"protobufjs": "^6.8.4",
"rollup": "^0.53.3",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0"
}
}
import commonjs from 'rollup-plugin-commonjs'
import resolve from 'rollup-plugin-node-resolve'
import pkg from './package.json'
export default {
input: 'index.js',
output: [
{
file: pkg.main,
format: 'cjs'
},
{
file: pkg.module,
format: 'es'
}
],
external: [
],
plugins: [
resolve(),
commonjs()
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment