react-spreadsheet icon indicating copy to clipboard operation
react-spreadsheet copied to clipboard

Error thrown when react-spreadsheet is imported

Open ankitgoyal100 opened this issue 5 years ago • 2 comments

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

ankitgoyal100 avatar Dec 27 '20 05:12 ankitgoyal100

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

iddan avatar Dec 27 '20 08:12 iddan

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
  },
};

ankitgoyal100 avatar Dec 27 '20 12:12 ankitgoyal100

This is solved with [email protected]

iddan avatar Apr 22 '23 10:04 iddan