Skip to content

Commit

Permalink
fix(build): no longer publishing "module" either
Browse files Browse the repository at this point in the history
Giving up on this: there isn't a great reason to publish modules
here as they won't be significantly tree-shook, and it bloats
the published package.

Fixes incompatiblity in 4.4.0 with webpack, where webpack is now
selecting "module" because "browser" is no longer present.
  • Loading branch information
STRML committed May 12, 2020
1 parent 75d75d7 commit fa030e2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 18 deletions.
9 changes: 1 addition & 8 deletions .babelrc.js
@@ -1,18 +1,11 @@
'use strict';

// If set, we put Babel in "esmMode", i.e. leave import/export intact.
// Good for webpack and for an esm build.
const esmMode = process.env.BABEL_MODULE_TYPE === "module";
const es6Compat = process.env.BABEL_ES_COMPAT === "6";

module.exports = {
"presets": [
[
"@babel/preset-env",
{
// Don't transpile import/export in esmMode.
modules: esmMode ? false : "auto",
targets: es6Compat ? "maintained node versions" : undefined
targets: "> 0.25%, not dead"
},
],
"@babel/react",
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Expand Up @@ -21,9 +21,6 @@ build: clean build-cjs build-esm build-web
build-cjs: $(BIN)
$(BIN)/babel --out-dir ./build/cjs ./lib

build-esm: $(BIN)
env BABEL_MODULE_TYPE="module" BABEL_ES_COMPAT="6" $(BIN)/babel --out-dir ./build/module ./lib

build-web: $(BIN)
$(BIN)/webpack --mode=production --display-modules

Expand Down
2 changes: 0 additions & 2 deletions karma-phantomjs.conf.js
@@ -1,8 +1,6 @@
'use strict';

const baseConfig = require('./karma.conf.js');
// Phantom build can't handle the modern JS in the module build
process.env.BABEL_MODULE_TYPE = 'cjs';

module.exports = function(config) {
// Set base config options.
Expand Down
5 changes: 0 additions & 5 deletions webpack.config.js
@@ -1,11 +1,6 @@
const path = require('path');
const webpack = require('webpack');

// Grabbed in .babelrc.js to switch on transpiling modules.
// We want webpack to handle modules if possible.
// This can be overridden and webpack will handle babelified CJS.
process.env.BABEL_MODULE_TYPE = process.env.BABEL_MODULE_TYPE || 'module';

module.exports = (env, argv) => ({
entry: {
'react-draggable.min': './lib/cjs.js',
Expand Down

0 comments on commit fa030e2

Please sign in to comment.