Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve 'react-excel-workbook' #14

Open
ElviraCB opened this issue Mar 8, 2018 · 1 comment
Open

Cannot resolve 'react-excel-workbook' #14

ElviraCB opened this issue Mar 8, 2018 · 1 comment

Comments

@ElviraCB
Copy link

ElviraCB commented Mar 8, 2018

I've copy pasted the code on how to use the react excel workbook and added the code lines to my webpack config..

When I try to import the library I'm getting the following error:

Module not found: Error: Can't resolve 'react-excel-workbook' in '/usr/src/app/src'

I've installed the library withnpm install 'react-excel-workbook' command.

I can view the library in my node_modules folder.

I use this code to import the library:
import Workbook from 'react-excel-workbook';

Webpack config:

// webpack.config.js
const webpack = require('webpack')
const path = require('path')
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');

const config = {
  context: path.resolve(__dirname, 'src'),
  entry: './app.js',
  devServer: {
    contentBase: './dist'
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".ts", ".tsx", ".js", ".json"]
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.resolve(__dirname, 'src'),
        use: [{
          loader: 'babel-loader',
          options: {
            presets: [
              ['env', { modules: false }],
              "react"
            ]
          }
        }]
      },
      {
        test: /\.tsx?$/,
        loader: "awesome-typescript-loader"
      },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract('css-loader')
      }
    ]
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('development')
    }),
    new ExtractTextPlugin('bundle.css'),
    new CopyWebpackPlugin([
      { from: './cb_icons', to:'cb_icons' },
    ]),
  ],
  node: {fs: 'empty'},
  externals: [
    {'./cptable': 'var cptable'},
    {'./jszip': 'jszip'}
  ]
}

module.exports = config
@rahulraj-120799
Copy link

Use yarn add react-excel-workbook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants