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

Fix #114: webpack bundling #124

Merged
merged 6 commits into from Dec 2, 2015

Conversation

mmollick
Copy link
Contributor

@mmollick mmollick commented Dec 2, 2015

This PR fixes #114.

Webpack doesn't seem to like having expressions in a require. The fix required generating an index.js for the language files and loading this rather than looping through using fs.

In short what I've done:

  1. Added grunt languages to generate an index file for the languages
  2. Removed requireDir as a dependency, now we just load the index file in the tests
  3. We no longer load language files with fs and path but just require the index file directly in the loadCulturesInNode method

@BenjaminVanRyseghem
Copy link
Owner

Looks really good 👍

Thank you 😄

BenjaminVanRyseghem added a commit that referenced this pull request Dec 2, 2015
@BenjaminVanRyseghem BenjaminVanRyseghem merged commit c6093f1 into BenjaminVanRyseghem:develop Dec 2, 2015
@pwambach
Copy link

Hi,

had the same problem with webpack. The PR above fixed the webpack builds for me. Do you plan to make a release with this fix in the near future?

Thx,
Phil

@BenjaminVanRyseghem
Copy link
Owner

I can do it 😉

@pwambach
Copy link

Thanks, would save me a lot of time trying to get around the errors in the webpack config! 😄
Awesome work btw!

@randytarampi
Copy link

Hey there, is there anything stopping this from being released? I'd love to stop hacking around the issue in my webpack config.

@BenjaminVanRyseghem
Copy link
Owner

I am sorry, I know I said I will release it,
but at work we have a dead line tomorrow,
so I am running a bit out of time 😕

My apologies

@virgiliu
Copy link

Getting an error when trying to use numbro 1.6.2 with webpack.


> webapp@0.0.0 start /Users/topkek/Documents/projects/a-project
> babel-node tools/run.js start

[15:34:42] Starting 'start'...
[15:34:42] Starting 'copy'...
[15:34:42] Finished 'copy' after 19 ms
[15:34:42] Starting 'bundle'...
[15:34:45] Finished 'bundle' after 3894 ms
[15:34:45] Starting 'runServer'...
[15:34:45] Finished 'runServer' after 8 ms
[15:34:45] Finished 'start' after 3926 ms
The server is running at http://localhost:5000
webpack built c17300f98cb681cff21a in 8675ms
Hash: c17300f98cb681cff21a
Version: webpack 1.12.13
Time: 8675ms
                               Asset     Size  Chunks       Chunk Names
1a0c55bf6b0e0333f4936e41653bc3ae.svg  13.9 kB               
ea44c02471914cb9fe109840021cd794.png  19.7 kB               
dba9bf162425473e25ef6ddc8283b35e.png  19.4 kB               
                             main.js   4.9 MB       0       main
       main.css?c17300f98cb681cff21a  61.4 kB       0       main
chunk    {0} main.js, main.css?c17300f98cb681cff21a (main) 1.84 MB [rendered]
    [0] multi main 40 bytes {0} [built]
    [1] (webpack)-hot-middleware/client.js 3.43 kB {0} [built]
    [...truncated]

WARNING in ./~/numbro/numbro.js
Critical dependencies:
960:26-85 the request of a dependency is an expression
 @ ./~/numbro/numbro.js 960:26-85

WARNING in ./~/numbro/CHANGELOG-Numeraljs.md
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/CHANGELOG-Numeraljs.md Line 1: Unexpected identifier
You may need an appropriate loader to handle this file type.
| _This is the historical changelog for the [`numeral-js`
| project](https://github.com/adamwdraper/Numeral-js), which `numbro` is built upon. The `numbro`
| changelog is at [CHANGELOG.md](CHANGELOG.md)._
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/LICENSE
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/LICENSE Line 1: Unexpected number
You may need an appropriate loader to handle this file type.
| Copyright (c) 2015 Företagsplatsen
| 
| Permission is hereby granted, free of charge, to any person
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/CHANGELOG.md
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/CHANGELOG.md Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| ### 1.6.2
| 
| - Fix deprecated use of `language` and introduce `cultureCode`. Thanks @BenjaminVanRyseghem
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/LICENSE-Numeraljs
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/LICENSE-Numeraljs Line 1: Unexpected number
You may need an appropriate loader to handle this file type.
| Copyright (c) 2014 Adam Draper
| 
| Permission is hereby granted, free of charge, to any person
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/README.md
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/README.md Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| # [numbro](https://numbrojs.com/)
| 
| [![Join the chat at https://gitter.im/foretagsplatsen/numbro](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/foretagsplatsen/numbro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/dist/numbro.js
Critical dependencies:
960:26-85 the request of a dependency is an expression
 @ ./~/numbro/dist/numbro.js 960:26-85

WARNING in ./~/numbro/dist/numbro.min.js
Critical dependencies:
8:10112-10142 the request of a dependency is an expression
 @ ./~/numbro/dist/numbro.min.js 8:10112-10142

WARNING in ./~/numbro/resources/LICENSE
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/resources/LICENSE Line 1: Unexpected number
You may need an appropriate loader to handle this file type.
| Copyright 2015 Benjamin Van Ryseghem
| 
| Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
 @ ./~/numbro ^\.\/.*$

WARNING in ./~/numbro/resources/README.md
Module parse failed: /Users/topkek/Documents/projects/a-project/node_modules/numbro/resources/README.md Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| # Ranko the Raccoon
| 
| Ranko is the mascott of the [numbro](https://github.com/foretagsplatsen/numbro) project.
 @ ./~/numbro ^\.\/.*$

ERROR in ./~/numbro/numbro.js
Module not found: Error: Cannot resolve module 'fs' in /Users/topkek/Documents/projects/a-project/node_modules/numbro
 @ ./~/numbro/numbro.js 976:17-30 989:17-30

ERROR in ./~/numbro/Gruntfile.js
Module not found: Error: Cannot resolve module 'fs' in /Users/topkek/Documents/projects/a-project/node_modules/numbro
 @ ./~/numbro/Gruntfile.js 1:9-22

ERROR in ./~/numbro/dist/numbro.js
Module not found: Error: Cannot resolve module 'fs' in /Users/topkek/Documents/projects/a-project/node_modules/numbro/dist
 @ ./~/numbro/dist/numbro.js 976:17-30 989:17-30

ERROR in ./~/numbro/dist/numbro.min.js
Module not found: Error: Cannot resolve module 'fs' in /Users/topkek/Documents/projects/a-project/node_modules/numbro/dist
 @ ./~/numbro/dist/numbro.min.js 8:10331-10344 8:10477-10490

ERROR in ./~/numbro/tests/languages/locale-codes.js
Module not found: Error: Cannot resolve module 'require-dir' in /Users/topkek/Documents/projects/a-project/node_modules/numbro/tests/languages
 @ ./~/numbro/tests/languages/locale-codes.js 3:17-39
Child extract-text-webpack-plugin:
    chunk    {0} extract-text-webpack-plugin-output-filename 107 kB [rendered]
        [0] ./~/css-loader?sourceMap&!./~/resolve-url-loader!./~/sassport-loader?outputStyle=compact!./src/styles/main.scss 73.3 kB {0} [built]
        [1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
        [2] ./src/public/ff-logo-white.svg 5.11 kB {0} [built]
        [3] ./src/public/smart-phone-icon.svg 809 bytes {0} [built]
        [4] ./src/public/9am-12am.svg 1.93 kB {0} [built]
        [5] ./src/public/12am-2pm.svg 2.8 kB {0} [built]
        [6] ./src/public/2pm-530pm.svg 6.8 kB {0} [built]
        [7] ./src/public/530pm-7pm.svg 4.67 kB {0} [built]
        [8] ./src/public/after-7pm.svg 7.58 kB {0} [built]
        [9] ./src/public/arrow-down.svg 841 bytes {0} [built]
       [10] ./src/public/calendar.svg 389 bytes {0} [built]
       [11] ./src/public/user-icon.svg 705 bytes {0} [built]
       [12] ./src/public/check.svg 537 bytes {0} [built]

@fxfilmxf
Copy link

+1 me too. I had to go back to using numeral for now :(

@mmollick
Copy link
Contributor Author

@BenjaminVanRyseghem any idea when you'll be able to release this?

@BenjaminVanRyseghem
Copy link
Owner

done 😄

In numbro 1.7.0

@BenjaminVanRyseghem
Copy link
Owner

@mmollick it looks like your change breaks the numbro website as exports is undefined.

You can see it by going here with open dev tools

@mmollick
Copy link
Contributor Author

Sorry about that @BenjaminVanRyseghem, github didn't let me know I got a reply. I'm seeing the issue too, I'll check this out in a little while.

@mmollick mmollick deleted the webpack branch March 29, 2016 13:55
@mmollick mmollick mentioned this pull request Mar 29, 2016
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

Successfully merging this pull request may close these issues.

Error bundling with Webpack
6 participants