Can't define a namedExports
Hey there! I'm trying to set a namedExports in a Lerna project as follow:
commonjs({
include: '**/*',
namedExports: {
'packages/button/node_modules/classnames/index.js': ['classnames']
}
}),
I have tried other keys such as: classnames, node_modules/classnames/index.js, ./node_modules/classnames/index.js without success... in all cases I'm getting the following error:
λ ~/Workspace/react-spectre/ master* yarn build -- --verbose
yarn build v0.24.6
$ cross-env NODE_ENV=production rollup -c --verbose
/a/b/c/react-spectre/packages/button/src/index.js → packages/button/dist/button.umd.js...
[!] Error: 'default' is not exported by packages/button/node_modules/classnames/index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
packages/button/src/Button.js (3:7)
1: import React from 'react'
2: import PropTypes from 'prop-types'
3: import classnames from 'classnames'
^
getting the same issue here :(
Could you retry with v8.3.0?
Same issue with 8.3.0
Hello,
I got same problem I think
import React from 'react';
...
/** non of this options work, 1st should be more correct */
import createHashHistory from 'history/lib/createHashHistory';
/** I tried amend dependency locally, didn't worked, unless it is not ES6 module */
import { createHashHistory } from 'history/createBrowserHistory';
...
Dependency: https://github.com/ReactTraining/history/releases/tag/v1.17.0
I can't share project code, because or non-disclosure
const rollup = require('rollup-stream'); // ^1.24.1 + "rollup": "^0.56.0",
const jsonify = require('rollup-plugin-json'); // ^2.3.0
const cjs = require('rollup-plugin-commonjs'); // ^8.3.0
const npm = require('rollup-plugin-node-resolve'); // ^3.0.3
const babelify = require('rollup-plugin-babel'); // ^3.0.3
config file: {
input: entry,
format: 'iife',
external: ['react-dom'],
sourcemap: true,
plugins: [
jsonify(),
babelify({
babelrc: false,
exclude: 'node_modules/**',
presets: [
[
'es2015',
{
modules: false
}
],
'stage-0',
'react'
],
plugins: ['external-helpers']
}),
npm({
jsnext: true
}),
cjs({
exclude: [
'**/*.css'
],
include: [
'node_modules/create-react-class/**',
'node_modules/fbjs/**',
'node_modules/object-assign/**',
'node_modules/react/**',
'node_modules/react-dom/**',
'node_modules/prop-types/**'
]
}),
]
}
eventually, it seems that any non-ES6 module with construction module.exports = exports['default']; doesn't satisfy criteria
same code use to work, without rollup [with browserify + babel ]
include: [
/** by adding this >>> */ '**/*', /** solved issue, but I think it is hacky way :) as node_modules/** or node_modules/**/* didn't work =/ */
'node_modules/create-react-class/**',
'node_modules/fbjs/**',
'node_modules/object-assign/**',
'node_modules/react/**',
'node_modules/react-dom/**',
'node_modules/prop-types/**'
]
Instead of include: '**/*', you could use pattern include: /node_modules/.
Related PR: https://github.com/rollup/rollup-plugin-commonjs/pull/197
Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. :beer: