Replace Browserify with Rollup
Replace Browserify with Rollup as a module bundler. This brings several advantages: - It is a more modern bundler that has better support in the ecosystem, more active maintenence, fewer dependencies and is easier to write plugins for. The core team also maintain most of the plugins that we need. - It has native support for modern platform features like ES modules, including dynamic import for lazy-loading of functionality. - It generates smaller bundles due to its ability to do tree shaking and scope hoisting. The new bundles are generated as ES modules rather than UMD / IIFE bundles. Our target browsers now all support ES modules and this will enable us to use native static/dynamic imports for code splitting or lazy-loading of functionality in future. The initial Rollup build generates one bundle per application (boot script, annotator, sidebar). This simplifies the build process and minimizes production bundle size, at the cost of making incremental updates during development slightly slower. Build performance is currently similar to or a little slower than Browserify. We can optimize this by adding caching of transforms (mainly Babel) and pre-building of a vendor bundle containing large dependencies. As part of changing the bundler this also changes how the code is packaged for tests. We now do the bundling ourselves rather than using a Karma integration. This makes it much easier to inspect the processed code and fix problems. It also makes it easier to optimize the bundle building in future.
Showing
... | ... | @@ -14,6 +14,13 @@ |
"@babel/preset-react": "^7.0.0", | ||
"@hypothesis/frontend-shared": "3.13.0", | ||
"@octokit/rest": "^18.0.0", | ||
"@rollup/plugin-alias": "^3.1.2", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^19.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"@rollup/plugin-replace": "^2.4.2", | ||
"@rollup/plugin-virtual": "^2.0.3", | ||
"@sentry/browser": "^6.0.2", | ||
"approx-string-match": "^1.1.0", | ||
"autoprefixer": "^10.0.1", | ||
... | ... | @@ -21,11 +28,8 @@ |
"axe-core": "^4.0.0", | ||
"babel-plugin-inject-args": "^1.0.0", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
"babel-plugin-mockable-imports": "^1.5.1", | ||
"babel-plugin-mockable-imports": "^1.8.0", | ||
"babel-plugin-transform-async-to-promises": "^0.8.6", | ||
"babelify": "^10.0.0", | ||
"browserify": "^17.0.0", | ||
"browserify-versionify": "^1.0.6", | ||
"chai": "^4.1.2", | ||
"chance": "^1.0.13", | ||
"classnames": "^2.2.4", | ||
... | ... | @@ -45,20 +49,16 @@ |
"eslint-plugin-mocha": "^9.0.0", | ||
"eslint-plugin-react": "^7.12.4", | ||
"eslint-plugin-react-hooks": "^4.0.4", | ||
"exorcist": "^2.0.0", | ||
"express": "^4.14.1", | ||
"fancy-log": "^1.3.3", | ||
"fetch-mock": "9", | ||
"focus-visible": "^5.0.0", | ||
"gulp": "^4.0.0", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-changed": "^4.0.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-replace": "^1.0.0", | ||
"gulp-sourcemaps": "^3.0.0", | ||
"hammerjs": "^2.0.4", | ||
"karma": "^6.0.1", | ||
"karma-browserify": "^8.0.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage-istanbul-reporter": "^3.0.2", | ||
... | ... | @@ -67,7 +67,6 @@ |
"karma-sinon": "^1.0.5", | ||
"katex": "^0.13.0", | ||
"lodash.debounce": "^4.0.3", | ||
"loose-envify": "^1.4.0", | ||
"mocha": "9.1.2", | ||
"mustache": "^4.0.1", | ||
"mustache-express": "^1.3.0", | ||
... | ... | @@ -81,44 +80,25 @@ |
"redux-thunk": "^2.1.0", | ||
"reselect": "^4.0.0", | ||
"retry": "^0.13.1", | ||
"rollup": "^2.47.0", | ||
"rollup-plugin-string": "^3.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"sass": "^1.23.0", | ||
"scroll-into-view": "^1.8.2", | ||
"shallowequal": "^1.1.0", | ||
"showdown": "^1.6.4", | ||
"sinon": "^11.1.1", | ||
"stringify": "^5.1.0", | ||
"terser": "^5.0.0", | ||
"through2": "^4.0.1", | ||
"tiny-emitter": "^2.0.2", | ||
"typescript": "^4.0.2", | ||
"vinyl": "^2.2.0", | ||
"watchify": "^4.0.0", | ||
"wrap-text": "^1.0.7" | ||
}, | ||
"browserslist": "chrome 70, firefox 70, safari 11.1", | ||
"browserify": { | ||
"transform": [ | ||
"browserify-versionify", | ||
[ | ||
"stringify", | ||
{ | ||
"appliesTo": { | ||
"includeExtensions": [ | ||
".html", | ||
".svg" | ||
] | ||
} | ||
} | ||
] | ||
] | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
"singleQuote": true | ||
}, | ||
"browser": { | ||
"fetch-mock": "./node_modules/fetch-mock/cjs/client.js" | ||
}, | ||
"main": "./build/boot.js", | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production gulp build", | ||
... | ... |
rollup-tests.config.js
0 → 100644
rollup.config.js
0 → 100644
This source diff could not be displayed because it is too large. You can view the blob instead.
Please register or sign in to comment