Last active
January 9, 2018 22:55
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
dist | |
package-lock.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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