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

ArgHandler error on Webpack/UglifyJS build #74

Closed
rdubbeldam86 opened this issue Aug 4, 2017 · 5 comments
Closed

ArgHandler error on Webpack/UglifyJS build #74

rdubbeldam86 opened this issue Aug 4, 2017 · 5 comments

Comments

@rdubbeldam86
Copy link

Using the latest versions of
NodeJS
VueJS
Webpack
xlsx-populate

When running the build option we get an error on the pages including xlsx-populate.
image

We also got a 'Can't resolve fs' error on the dev build. We fixed this by adding the following to the webpack config:
node: {
fs: 'empty',
}

This solution was provided for the same issue in another package:
webpack-contrib/css-loader#447

Could these 2 issues be related to each other?

Steps to reproduce:
Setup new project using the vue-cli (default webpack project)
Install xlsx-populate
run 'npm run build' to create the production files. This should give you the error(s).

Or download the zip with sample project (without node_modules folder).
test.zip

And run 'npm install' followed by 'npm run build'

@dtjohnson
Copy link
Owner

Hmmm.... I'm not sure what the issue is. The fs empty config is expected as we used Node's fs (if available) to load/write files. I'm able to get webpack to work fine by itself:
image

Here's my index.js:

import XlsxPopulate from 'xlsx-populate';

And here's my webpack.config.js:

module.exports = {
  node: {
    fs: 'empty'
  }
};

@dtjohnson
Copy link
Owner

I'm going to close this since I can't reproduce. Please reopen if you can provide more detail.

@vickdayaram
Copy link

Hi, I am actually running into the above issue, and I am not sure how to solve it. Here is the error that I am getting:

ERROR in app-9c9bcdfb7ba5099216d1.js from UglifyJs
Unexpected token: name (ArgHandler) [../node_modules/xlsx-populate/lib/ArgHandler.js:9,0][app-9c9bcdfb7ba5099216d1.js:122005,6]

I am able to run npm run buildlib, but when I run npm run build I get this error.

I updated the webpack config with:

node: {fs: 'empty'}

This got rid of the initial error that allowed me to work with the library.

For my index.js I am using the following to access xlsx-populate:

import * as XlsxPopulate from 'xlsx-populate'

I am using typescript which is why I am using that syntax.

Any help would be greatly appreciated, thanks!

@vickdayaram
Copy link

Never mind, after digging a bit deeper I found my problem, in a previous question.

#105

If anyone else is having this issue, what solved it for me was updating the import statement to the following:

import * as XlsxPopulate from 'xlsx-populate/browser/xlsx-populate';

Thanks for the help!

@nitsanavni
Copy link
Contributor

@vickdayaram worked for me too. Thanks!

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

4 participants