Skip to content

Commit 7f81071

Browse files
committed
fix(build): remove "browser" field in package.json
There is nothing special in the browser build that is actually practical for modern use. The "browser" field, as defined in https://github.com/defunctzombie/package-browser-field-spec#overview, indicates that you should use it if you are directly accessing globals, using browser-specific features, dom manipulation, etc. React components like react-draggable are built to do minimal raw DOM manipulation, and to always gate this behind conditionals to ensure that server-side rendering still works. We don't make any changes to any of that for the "browser" build, so it's entirely redundant. Hoping this also fixes the "Super expression must either be null or a function" error (#472) that some users have experienced with particular bundler configurations. The browser build may still be imported at "build/web/react-draggable.min.js". This is to prevent breakage only. The file is no longer minified to prevent possible [terser bugs](terser/terser#308).
1 parent 870dcde commit 7f81071

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "4.3.1",
44
"description": "React draggable component",
55
"main": "build/cjs/cjs.js",
6-
"browser": "build/web/react-draggable.min.js",
76
"module": "build/module/Draggable.js",
87
"scripts": {
98
"test": "make test",

webpack.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const path = require('path');
22
const webpack = require('webpack');
3-
const TerserPlugin = require('terser-webpack-plugin');
43

54
// Grabbed in .babelrc.js to switch on transpiling modules.
65
// We want webpack to handle modules if possible.
@@ -65,10 +64,6 @@ module.exports = (env, argv) => ({
6564
new webpack.optimize.ModuleConcatenationPlugin(),
6665
],
6766
optimization: {
68-
minimizer: [new TerserPlugin({
69-
include: /\.min\.js$/,
70-
sourceMap: true,
71-
terserOptions: {}
72-
})],
67+
minimize: false,
7368
}
7469
});

0 commit comments

Comments
 (0)