Using xlsx with Webpack on the browser.
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Using xlsx with Webpack on the browser. · Issue #467 - GitHub
I am using xlsx with Webpack on the browser. import XSLX from "xslx";. Importing XSLX is throwing an error in Webpack compilation that...
Read more >importing xlsx package shows module not found
I have installed xlsx 0.18.5 npm package to export xlsx files, I found out that's a webpack issue (https://github.com/SheetJS/sheetjs/issues/ ...
Read more >Bundlers | SheetJS Community Edition
SheetJS predates ECMAScript modules and bundler tools like Webpack. As best. ... use XLSX . ... Both the node and browser platforms work...
Read more >file-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Create an .xlsx file in a browser | by Marian Čaikovski - Medium
The SheetJS package downloaded with command npm install xlsx includes several files. The complete SheetJS library is saved in file ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found this answer on another thread. Add the below configuration to the webpack.config file.
@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 <style> tag as eg. @font-face{ src:url(assets/fonts/font.ttf); }
} }, ]; const plugins = []
module.exports = { context: __dirname + ‘’, entry: { app: ‘./webpackApp.js’ , vendor: ‘./webpackJQ.js’ // , bundlejs: ‘./webpackJQ.js’ }, output: { path: __dirname + ‘/public/webpack-min’, filename: ‘bundle.js’ } , plugins: [ new webpack.ProvidePlugin({ ‘$’: “jquery”, ‘jQuery’: “jquery”, ‘jquery’: “jquery”, ‘window.$’: “jquery”, ‘window.jQuery’: “jquery”, “window.moment”: “moment”, “moment”: “moment”, ‘_’:‘underscore’, “underscore”: “underscore”, })
};
from my webpackJQ.js file I am using require(‘./public/asset/libs/js/xlsx.core.min.js’);
Did I miss something ?