I am using xlsx with Webpack on the browser.
import XSLX from "xslx";
Importing XSLX is throwing an error in Webpack compilation that fs module could not be found.

Having the same issue here. Any ideas on how to solve it?
I found this answer on another thread. Add the below configuration to the webpack.config file.
// required for xlsx to work with webpack
node: {
fs: 'empty'
},
externals: [
{
'./cptable': 'var cptable'
},
{
'./jszip': 'jszip'
}
],
@vijayst Thank you for sharing your solution. Works like a charm.
also getting errors when integrating xlsx.core.min.js in webpack
ERROR in ./public/asset/libs/js/xlsx.core.min.js
Module not found: Error: Can't resolve './dist/cpexcel' in '/home/dinesh/Paxcom/kinator/public/asset/libs/js'
@ ./public/asset/libs/js/xlsx.core.min.js 5:15462-15487
@ ./webpackJQ.js
ERROR in ./public/asset/libs/js/xlsx.core.min.js
Module not found: Error: Can't resolve './dist/ods' in '/home/dinesh/Paxcom/kinator/public/asset/libs/js'
@ ./public/asset/libs/js/xlsx.core.min.js 9:159-183
@ ./webpackJQ.js
@dineshjain1992 you are using a very old version. The relevant issue has been resolved in later versions
I am using webpack": "^3.8.1" version
@reviewher
Here is my webpack.config file
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
var IgnorePlugin = require('watch-ignore-webpack-plugin')
var jquery = require('jquery');
var underscore = require('underscore');
var moment = require('moment');
const rules = [
{
test: /.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader"]
})
}
,{
test: /.(woff(2)?|ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, //to support @font-face rule
loader: "url-loader",
query:{
limit:'10000',
name:'font.css',
outputPath:'fonts/'
//the fonts will be emmited to public/assets/fonts/ folder
//the fonts will be put in the DOM
Most helpful comment
I found this answer on another thread. Add the below configuration to the webpack.config file.