hy20090501 / react-dragme

react 拖曳组件
2 stars 0 forks source link

大神你会rollup吗,我使用rollup打包react报错 #1

Open zhangwei900808 opened 7 years ago

zhangwei900808 commented 7 years ago
// Rollup plugins.
import babel from 'rollup-plugin-babel'
import cjs from 'rollup-plugin-commonjs'
import globals from 'rollup-plugin-node-globals'
import replace from 'rollup-plugin-replace'
import resolve from 'rollup-plugin-node-resolve'
import uglify from 'rollup-plugin-uglify'

export default {
  dest: 'build/ReactCdPlayer.js',
  entry: 'src/containers/ReactCdPlayer.js',
  format: 'iife',
  plugins: [
    babel({
      babelrc: false,
      exclude: 'node_modules/**',
      presets: [ [ 'es2015', { modules: false } ], 'stage-0', 'react' ],
      plugins: [ 'external-helpers' ]
    }),
    cjs({
      exclude: 'node_modules/process-es6/**',
      include: [
        'node_modules/fbjs/**',
        'node_modules/object-assign/**',
        'node_modules/react/**',
        'node_modules/react-dom/**',
        'node_modules/prop-types/**'
      ]
    }),
    globals(),
    replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
    resolve({
      browser: true,
      main: true
    }),
    uglify()
  ],
  sourceMap: true
}
{
  "name": "react-cd-player",
  "homepage": "http://zhangwei900808.github.io/react-cd-player",
  "version": "0.3.0",
  "main": "index.js",
  "dependencies": {
    "classnames": "^2.2.5",
    "material-ui": "next",
    "material-ui-icons": "^1.0.0-alpha.19",
    "node-sass-chokidar": "^0.0.3",
    "npm-run-all": "^4.0.2",
    "react": "^15.6.1",
    "react-dom": "^15.6.1"
  },
  "devDependencies": {
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-es2015-rollup": "^3.0.0",
    "babel-preset-latest": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "babel-preset-stage-1": "^6.24.1",
    "gh-pages": "^1.0.0",
    "react-scripts": "1.0.11",
    "rollup": "^0.45.2",
    "rollup-plugin-babel": "^3.0.1",
    "rollup-plugin-commonjs": "^8.1.0",
    "rollup-plugin-node-globals": "^1.1.0",
    "rollup-plugin-node-resolve": "^3.0.0",
    "rollup-plugin-replace": "^1.1.1",
    "rollup-plugin-uglify": "^2.0.1"
  },
  "scripts": {
    "build-css": "node-sass-chokidar src/assets/css/ -o src/assets/css/",
    "watch-css": "npm run build-css && node-sass-chokidar src/assets/css/ -o src/assets/css/ --watch --recursive",
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",
    "build": "npm run build-css && react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "rollup-build": "rollup -c",
    "rollup-production-build": "NODE_ENV=production rollup -c"
  }
}
$ rollup -c
🚨   Error: 'default' is not exported by node_modules/material-ui-icons/FastRewind.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src/containers/ReactCdPlayer.js (6:7)
4: import PropTypes from 'prop-types';
5: import FastForward from 'material-ui-icons/FastForward';
6: import FastRewind from 'material-ui-icons/FastRewind';
          ^
7: import { LinearProgress } from 'material-ui/Progress';

error Command failed with exit code 1.

image

hy20090501 commented 7 years ago

未用过这个,会尝试使用。