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

Webpack and alasql - documentation note? #440

Closed
nickdeis opened this issue Oct 16, 2015 · 10 comments
Closed

Webpack and alasql - documentation note? #440

nickdeis opened this issue Oct 16, 2015 · 10 comments

Comments

@nickdeis
Copy link
Contributor

Hey alasql devs,
Alasql doesn't work well with webpack since alasql uses "exports" to detected whether or not it's in node.js or the browser (not ideal but understandable).
However, this causes issues with webpack, because the is analyzed in node.

I don't think this warrants a code change, but adding a documentation note to use script-loader and load alasql as follows

import alasql from "script!alasql";

Best,
Nick

@mathiasrw
Copy link
Member

Great - thanks for the pull request !

mathiasrw added a commit that referenced this issue Oct 16, 2015
#440: Webpack and alasql - documentation note
@kiranps
Copy link

kiranps commented Jul 18, 2016

@nickdeis

import alasql from "script!alasql";

gives the following error

Uncaught TypeError: (0 , _scriptAlasql2.default) is not a function

import "script!alasql"; works fine

@mathiasrw
Copy link
Member

@kiranps

Nice !

I will update the documentation...

@mathiasrw
Copy link
Member

@kiranps

Do you use the ignorePlugin things mentioned in https://github.com/agershun/alasql#webpack or can that be avoided with the import "script!alasql"; syntax?

@mathiasrw
Copy link
Member

@kiranps

Any news on this?

@kiranps
Copy link

kiranps commented Jul 21, 2016

@mathiasrw thanks ignorePlugin fixed the issue, i also had to add net|tls.

alasql is using some json file, webpack say i need a separate loader for that.

should i use a json loader or is there any way to remove those warning

@mathiasrw
Copy link
Member

mathiasrw commented Jul 21, 2016

Good to hear. I will update the documentation.

alasql is using some json file

are you asking it to store files? is it only from require('alasql')?

@kiranps
Copy link

kiranps commented Jul 21, 2016

i have not used any json-loader in my webpack config, that's why webpack is throwing this error.

using a json loader it will fix the issue,
but i don't think there is a need for json files while working in browser.

is there any way to hide these errors

/~/mime-db/db.json
Module parse failed: /home/XXX/XXXX/node_modules/mime-db/db.json Unexpected token (2:40)
You may need an appropriate loader to handle this file type.

@mathiasrw
Copy link
Member

Hmmm... I see.

Its a nice little 4th level nested dependency:

+-- alasql@0.2.7 
¦ +-- dom-storage@2.0.2 
¦ +-- es6-promise@3.2.1 
¦ +-- lodash@4.13.1 
¦ +-- request@2.73.0 
¦ ¦ +-- aws-sign2@0.6.0 
¦ ¦ +-- aws4@1.4.1 
¦ ¦ +-- bl@1.1.2 
¦ ¦ ¦ +-- readable-stream@2.0.6 
¦ ¦ ¦   +-- core-util-is@1.0.2 
¦ ¦ ¦   +-- isarray@1.0.0 
¦ ¦ ¦   +-- process-nextick-args@1.0.7 
¦ ¦ ¦   +-- string_decoder@0.10.31 
¦ ¦ ¦   +-- util-deprecate@1.0.2 
¦ ¦ +-- caseless@0.11.0 
¦ ¦ +-- combined-stream@1.0.5 
¦ ¦ ¦ +-- delayed-stream@1.0.0 
¦ ¦ +-- extend@3.0.0 
¦ ¦ +-- forever-agent@0.6.1 
¦ ¦ +-- form-data@1.0.0-rc4 
¦ ¦ ¦ +-- async@1.5.2 
¦ ¦ +-- har-validator@2.0.6 
¦ ¦ ¦ +-- chalk@1.1.3 
¦ ¦ ¦ ¦ +-- ansi-styles@2.2.1 
¦ ¦ ¦ ¦ +-- escape-string-regexp@1.0.5 
¦ ¦ ¦ ¦ +-- has-ansi@2.0.0 
¦ ¦ ¦ ¦ +-- supports-color@2.0.0 
¦ ¦ ¦ +-- commander@2.9.0 
¦ ¦ ¦ +-- is-my-json-valid@2.13.1 
¦ ¦ ¦ ¦ +-- generate-function@2.0.0 
¦ ¦ ¦ ¦ +-- generate-object-property@1.2.0 
¦ ¦ ¦ ¦ ¦ +-- is-property@1.0.2 
¦ ¦ ¦ ¦ +-- jsonpointer@2.0.0 
¦ ¦ ¦ ¦ +-- xtend@4.0.1 
¦ ¦ ¦ +-- pinkie-promise@2.0.1 
¦ ¦ ¦   +-- pinkie@2.0.4 
¦ ¦ +-- hawk@3.1.3 
¦ ¦ ¦ +-- boom@2.10.1 
¦ ¦ ¦ +-- cryptiles@2.0.5 
¦ ¦ ¦ +-- hoek@2.16.3 
¦ ¦ ¦ +-- sntp@1.0.9 
¦ ¦ +-- http-signature@1.1.1 
¦ ¦ ¦ +-- assert-plus@0.2.0 
¦ ¦ ¦ +-- jsprim@1.3.0 
¦ ¦ ¦ ¦ +-- extsprintf@1.0.2 
¦ ¦ ¦ ¦ +-- json-schema@0.2.2 
¦ ¦ ¦ ¦ +-- verror@1.3.6 
¦ ¦ ¦ +-- sshpk@1.8.3 
¦ ¦ ¦   +-- asn1@0.2.3 
¦ ¦ ¦   +-- assert-plus@1.0.0 
¦ ¦ ¦   +-- dashdash@1.14.0 
¦ ¦ ¦   ¦ +-- assert-plus@1.0.0 
¦ ¦ ¦   +-- ecc-jsbn@0.1.1 
¦ ¦ ¦   +-- getpass@0.1.6 
¦ ¦ ¦   ¦ +-- assert-plus@1.0.0 
¦ ¦ ¦   +-- jodid25519@1.0.2 
¦ ¦ ¦   +-- jsbn@0.1.0 
¦ ¦ ¦   +-- tweetnacl@0.13.3 
¦ ¦ +-- is-typedarray@1.0.0 
¦ ¦ +-- isstream@0.1.2 
¦ ¦ +-- json-stringify-safe@5.0.1 
¦ ¦ +-- mime-types@2.1.11 
¦ ¦ ¦ +-- mime-db@1.23.0             <- Welll helloooo therererr
¦ ¦ +-- node-uuid@1.4.7 
¦ ¦ +-- oauth-sign@0.8.2 
¦ ¦ +-- qs@6.2.1 
¦ ¦ +-- stringstream@0.0.5 
¦ ¦ +-- tough-cookie@2.2.2 
¦ ¦ +-- tunnel-agent@0.4.3 
¦ +-- xlsjs@0.7.5 
¦ ¦ +-- cfb@0.10.3 
¦ ¦ ¦ +-- commander@2.9.0 
¦ ¦ +-- codepage@1.3.8 
¦ ¦ ¦ +-- commander@2.9.0 
¦ ¦ ¦ +-- concat-stream@1.5.1 
¦ ¦ ¦ ¦ +-- typedarray@0.0.6 
¦ ¦ ¦ +-- voc@0.5.0 
¦ ¦ +-- commander@2.9.0 
¦ ¦ ¦ +-- graceful-readlink@1.0.1 
¦ ¦ +-- ssf@0.8.2 
¦ ¦   +-- frac@0.3.1 
¦ +-- xlsx@0.8.0 
¦ ¦ +-- adler-32@0.4.0 
¦ ¦ ¦ +-- exit-on-epipe@0.0.1 
¦ ¦ +-- commander@2.9.0 
¦ ¦ +-- crc-32@0.4.1 
¦ ¦ +-- jszip@2.4.0 
¦ ¦   +-- pako@0.2.8 
¦ +-- yargs@4.8.1 
¦   +-- cliui@3.2.0 
¦   ¦ +-- strip-ansi@3.0.1 
¦   ¦ ¦ +-- ansi-regex@2.0.0 
¦   ¦ +-- wrap-ansi@2.0.0 
¦   +-- decamelize@1.2.0 
¦   +-- get-caller-file@1.0.1 
¦   +-- lodash.assign@4.0.9 
¦   ¦ +-- lodash.keys@4.0.7 
¦   ¦ +-- lodash.rest@4.0.3 
¦   +-- os-locale@1.4.0 
¦   ¦ +-- lcid@1.0.0 
¦   ¦   +-- invert-kv@1.0.0 
¦   +-- read-pkg-up@1.0.1 
¦   ¦ +-- find-up@1.1.2 
¦   ¦ ¦ +-- path-exists@2.1.0 
¦   ¦ +-- read-pkg@1.1.0 
¦   ¦   +-- load-json-file@1.1.0 
¦   ¦   ¦ +-- parse-json@2.2.0 
¦   ¦   ¦ ¦ +-- error-ex@1.3.0 
¦   ¦   ¦ ¦   +-- is-arrayish@0.2.1 
¦   ¦   ¦ +-- pify@2.3.0 
¦   ¦   ¦ +-- strip-bom@2.0.0 
¦   ¦   ¦   +-- is-utf8@0.2.1 
¦   ¦   +-- normalize-package-data@2.3.5 
¦   ¦   ¦ +-- hosted-git-info@2.1.5 
¦   ¦   ¦ +-- is-builtin-module@1.0.0 
¦   ¦   ¦ ¦ +-- builtin-modules@1.1.1 
¦   ¦   ¦ +-- semver@5.3.0 
¦   ¦   ¦ +-- validate-npm-package-license@3.0.1 
¦   ¦   ¦   +-- spdx-correct@1.0.2 
¦   ¦   ¦   ¦ +-- spdx-license-ids@1.2.1 
¦   ¦   ¦   +-- spdx-expression-parse@1.0.2 
¦   ¦   ¦     +-- spdx-exceptions@1.0.5 
¦   ¦   +-- path-type@1.1.0 
¦   +-- require-directory@2.1.1 
¦   +-- require-main-filename@1.0.1 
¦   +-- set-blocking@2.0.0 
¦   +-- string-width@1.0.1 
¦   ¦ +-- code-point-at@1.0.0 
¦   ¦ ¦ +-- number-is-nan@1.0.0 
¦   ¦ +-- is-fullwidth-code-point@1.0.0 
¦   +-- which-module@1.0.0 
¦   +-- window-size@0.2.0 
¦   +-- y18n@3.2.1 
¦   +-- yargs-parser@2.4.1 
¦     +-- camelcase@3.0.0 
+-- surge@0.17.7
  +-- fstream-ignore@1.0.2
  ¦ +-- fstream@1.0.8
  ¦ ¦ +-- graceful-fs@4.1.4 
  ¦ ¦ +-- mkdirp@0.5.1 
  ¦ ¦ ¦ +-- minimist@0.0.8 
  ¦ ¦ +-- rimraf@2.5.3 
  ¦ ¦   +-- glob@7.0.5 
  ¦ ¦     +-- fs.realpath@1.0.0 
  ¦ ¦     +-- inflight@1.0.5 
  ¦ ¦     ¦ +-- wrappy@1.0.2 
  ¦ ¦     +-- minimatch@3.0.2 
  ¦ ¦     ¦ +-- brace-expansion@1.1.6 
  ¦ ¦     ¦   +-- balanced-match@0.4.2 
  ¦ ¦     +-- once@1.3.3 
  ¦ ¦     +-- path-is-absolute@1.0.0 
  ¦ +-- minimatch@2.0.10
  ¦   +-- brace-expansion@1.1.3
  ¦     +-- balanced-match@0.3.0 
  ¦     +-- concat-map@0.0.1 
  +-- prompt@0.2.14
  ¦ +-- utile@0.2.1
  ¦ ¦ +-- async@0.2.10 
  ¦ ¦ +-- deep-equal@1.0.1 
  ¦ ¦ +-- i@0.3.5 
  ¦ ¦ +-- ncp@0.4.2 
  ¦ +-- winston@0.8.3
  ¦   +-- colors@0.6.2 
  ¦   +-- cycle@1.0.3 
  ¦   +-- eyes@0.1.8 
  ¦   +-- pkginfo@0.3.1 
  ¦   +-- stack-trace@0.0.9 
  +-- request@2.40.0
  ¦ +-- form-data@0.1.4
  ¦ ¦ +-- combined-stream@0.0.7
  ¦ ¦   +-- delayed-stream@0.0.5 
  ¦ +-- hawk@1.1.1
  ¦ ¦ +-- boom@0.4.2 
  ¦ ¦ +-- cryptiles@0.2.2 
  ¦ ¦ +-- hoek@0.9.1 
  ¦ ¦ +-- sntp@0.2.4 
  ¦ +-- http-signature@0.10.1
  ¦   +-- asn1@0.1.11 
  ¦   +-- assert-plus@0.1.5 
  ¦   +-- ctype@0.5.3 
  +-- tar.gz@0.1.1
    +-- commander@1.1.1
    ¦ +-- keypress@0.1.0 
    +-- fstream@0.1.31
    ¦ +-- graceful-fs@3.0.8 
    ¦ +-- inherits@2.0.1 
    +-- tar@0.1.20
      +-- block-stream@0.0.9 

Hmm. I dont really know how to advice you. What if you add request to your ignorePlugin?

@nickdeis
Copy link
Contributor Author

Hey both: tbh, I no longer use the script loader. Instead I use the ignore plugin.
Here's the regexp I use:

/(^fs$|cptable|jszip|xlsx|xls|^es6-promise$|^net$|^tls$|^forever-agent$|^tough-cookie$|cpexcel|^path$)/

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

3 participants