Skip to content

Instantly share code, notes, and snippets.

@kevinfiol
Created January 17, 2019 16:43
Show Gist options
  • Save kevinfiol/86b304a4cd6be2847dcc8662f1aaa724 to your computer and use it in GitHub Desktop.
Save kevinfiol/86b304a4cd6be2847dcc8662f1aaa724 to your computer and use it in GitHub Desktop.
react/rollup/buble
λ yarn run start
yarn run v1.12.3
$ rollup -c -w --environment DEV
rollup v1.1.0
bundles ./src/index.js → public\app.js...
[!] (commonjs plugin) SyntaxError: Unexpected token (2821:19) in C:\.dev\js\.react\dota\node_modules\react-dom\cjs\react-dom.development.js
node_modules\react-dom\cjs\react-dom.development.js (2821:19)
2819: // on the client side because the browsers are inconsistent. Instead we call focus().
2820: 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
2821: // Microdata
^
2822: 'itemScope'].forEach(function (name) {
2823: properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
SyntaxError: Unexpected token (2821:19) in C:\.dev\js\.react\dota\node_modules\react-dom\cjs\react-dom.development.js
at Object.pp$4.raise (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:2770:13)
at Object.pp.unexpected (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:680:8)
at Object.pp.expect (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:674:26)
at Object.pp$3.parseExprList (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:2664:14)
at Object.pp$3.parseExprAtom (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:2209:26)
at Object.parseExprAtom (C:\.dev\js\.react\dota\node_modules\rollup\dist\rollup.js:16008:20)
at Object.parseExprAtom (C:\.dev\js\.react\dota\node_modules\rollup\dist\rollup.js:16027:75)
at Object.pp$3.parseExprSubscripts (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:2075:19)
at Object.pp$3.parseMaybeUnary (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:2052:17)
at Object.pp$3.parseExprOps (C:\.dev\js\.react\dota\node_modules\acorn\dist\acorn.js:1994:19)
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
{
"name": "dota",
"version": "1.0.0",
"description": "dota friends",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "rollup -c -w --environment DEV",
"build": "rollup -c --environment PROD"
},
"dependencies": {
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-redux": "^6.0.0",
"unfetch": "^4.0.1"
},
"devDependencies": {
"eslint": "^5.12.0",
"rollup": "^1.1.0",
"rollup-plugin-alias": "^1.5.1",
"rollup-plugin-buble": "0.19.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.1"
}
}
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import buble from 'rollup-plugin-buble';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';
const config = {
input: './src/index.js',
output: {
file: './public/app.js',
format: 'iife',
sourcemap: true
},
plugins: [
// when rollup-plugin-buble is >= 0.19.0, commonjs will throw an error
buble(),
replace({ 'process.env.NODE_ENV': JSON.stringify('development') }),
resolve(),
commonjs()
]
};
// Production Mods
if (process.env.PROD === 'true') {
// Disable Sourcemap
config.output.sourcemap = false;
// Uglify Bundle
config.plugins.push( uglify.uglify() );
}
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment