openfisca / legislation-explorer

Explore legislation formulas and parameters.
https://legislation.demo.openfisca.org
GNU Affero General Public License v3.0
26 stars 12 forks source link

Upgrade webpack #94

Closed fpagnoux closed 7 years ago

fpagnoux commented 7 years ago

Problem encountered trying to upgrade to wepack2:

I start the server with npm run dev:prod-api.

I get a few warnings, but the server starts correctly:

DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56.
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
[0] Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in  React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
[0] Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class

However, when I open a page, I get the error in the console:

yaml.js:263 Uncaught Error: Cannot find module "."
    at webpackMissingModule (yaml.js:263)
    at Object.defineProperty.value (yaml.js:263)
    at __webpack_require__ (bootstrap b3622f4…:659)
    at fn (bootstrap b3622f4…:85)
    at r (swagger-ui.js:1)
    at Object.<anonymous> (swagger-ui.js:1)
    at __webpack_require__ (bootstrap b3622f4…:659)
    at fn (bootstrap b3622f4…:85)
    at Object.<anonymous> (swagger.jsx:2)

And the JS of the page doesn't work properly.

yaml.js is a sub-sub dependency, that we probably don't use at all 😞 .

fpagnoux commented 7 years ago

This issue seems to describe the same problem, but the suggested fix, using swagger-ui-dist, doesn't work as we get an error Error: only one instance of babel-polyfill is allowed.

shockey commented 7 years ago

Hey @fpagnoux! We merged https://github.com/swagger-api/swagger-ui/pull/2959 yesterday, so our upcoming Swagger-UI release should resolve your babel-polyfill problem.

MattiSG commented 7 years ago

@fpagnoux who is this benefiting to? 🤔

MattiSG commented 7 years ago

Nice, thanks @shockey! 😃

fpagnoux commented 7 years ago

Thanks 🙂 !

fpagnoux commented 7 years ago

@fpagnoux who is this benefiting to? 🤔

This would have resolved issues encountered earlier, but as upgrading to webpack 2 didn't work, we found an alternative. I'm closing this PR, to be continued if one day we do need to upgrade.