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

Error thrown when react-spreadsheet is imported #95

Closed
ankitgoyal100 opened this issue Dec 27, 2020 · 3 comments
Closed

Error thrown when react-spreadsheet is imported #95

ankitgoyal100 opened this issue Dec 27, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@ankitgoyal100
Copy link

ERROR in ./node_modules/react-spreadsheet/dist/index.mjs 21:0-60
Module not found: Error: Can't resolve 'hot-formula-parser/lib/helper/cell' in '/Users/project/node_modules/react-spreadsheet/dist'
Did you mean 'cell.js'?
BREAKING CHANGE: The request 'hot-formula-parser/lib/helper/cell' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./frontend/src/components/Upload.tsx 16:0-44 84:40-51 86:40-51
 @ ./frontend/src/App.tsx 19:0-41 49:133-139
 @ ./frontend/src/index.tsx 3:0-24 9:28-31
@iddan
Copy link
Owner

iddan commented Dec 27, 2020

Thank you for reporting, which tools are you using to build your project?

@iddan iddan added the bug Something isn't working label Dec 27, 2020
@ankitgoyal100
Copy link
Author

ankitgoyal100 commented Dec 27, 2020

Here is my package.json:

{
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "start": "webpack --mode development --config webpack.config.js",
    "watch": "webpack --mode development --config webpack.config.js --watch",
    "build": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --mode=production",
    "build:stats": "webpack --mode production --json > stats.json",
    "build:analyze": "webpack-bundle-analyzer stats.json"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/react": "^16.9.27",
    "@types/react-dom": "^16.9.7",
    "awesome-typescript-loader": "^5.2.1",
    "clean-webpack-plugin": "^3.0.0",
    "compression-webpack-plugin": "^6.1.1",
    "css-loader": "^5.0.1",
    "mini-css-extract-plugin": "^1.3.1",
    "source-map-loader": "^1.1.2",
    "typescript": "^4.1.2",
    "webpack": "^5.6.0",
    "webpack-bundle-tracker": "^1.0.0-alpha.1",
    "webpack-cli": "^4.2.0",
    "webpack-dev-server": "^3.11.0"
  },
  "dependencies": {
    "axios": "^0.21.0",
    "bootstrap": "^4.5.3",
    "history": "^5.0.0",
    "node-sass": "^5.0.0",
    "papaparse": "^5.3.0",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.0",
    "react-dom": "^17.0.1",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-spreadsheet": "^0.5.0",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0"
  }
}

Here is my tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react",
    "module": "esnext",
    "noImplicitAny": false,
    "outDir": "./build/",
    "preserveConstEnums": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "es5",
    "esModuleInterop": true,
    "moduleResolution": "node"
  },
  "include": [
    "./frontend/src/*"
  ]
}

Here is my webpack.config.json:

const path = require("path");
var BundleTracker = require('webpack-bundle-tracker');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');

module.exports = {
  entry: {
    index: path.join(__dirname, 'frontend/src/index.tsx')
  },
  target: "web",
  output: {
    path: path.join(__dirname, "project/static/dist"),
    publicPath: "/static/",
    filename: '[name].js',
    chunkFilename: "[id]-[chunkhash].js",
  },
  plugins: [
    new CleanWebpackPlugin(),
    new BundleTracker({
      path: __dirname,
      filename: 'webpack-stats.json'
    }),
    new MiniCssExtractPlugin({
      filename: '[name].css',
      chunkFilename: '[id].[chunkhash].css',
    }),
    // Use to replace MomentJS - reducing bundle size
    new CompressionPlugin(),
  ],
  resolve: {
    extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],
  },
  module: {
    rules: [
      {
        test: /\.(ts|tsx)$/,
        loader: "awesome-typescript-loader",
        exclude: /node_modules/,
      },
      {
        test: /\.(scss|css)$/,
        use: [MiniCssExtractPlugin.loader, 'css-loader'],
      },
    ],
  },
  stats: {
    children: false
  },
};

@iddan
Copy link
Owner

iddan commented Apr 22, 2023

This is solved with react-spreadsheet@0.8.0

@iddan iddan closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants