Open sibelius opened 3 years ago
Could you post an example of a project where it's failing? Admittedly, it's an ancient loader but doing npm install evaluatex
should be downloading only transpiled code, not the sources. Requiring babel-register
is a development aid and it shouldn't normally be called.
I've made a tiny example here https://github.com/sibelius/evaluatex-webpack
yarn start
works well
yarn prod
will break
I suspect that Webpack is optimistically trying to resolve babel-loader
by statically analyzing the loader in evaluatex/index.js
. With this change, it appears to compile:
- import evaluatex from 'evaluatex';
+ import evaluatex from 'evaluatex/dist/evaluatex';
A lot has changed in transpiling/bundling since the original Evaluatex was written and the way it is loaded is not the way to do things anymore. While theoretically I might be able to remove the loader entirely and make package.json:main
point to dist/evaluatex.js
unconditionally, I don't want to do that until I've written some tests that ensure the library is compiled well for server, browser, and bundlers. I hope that this is an acceptable workaround until then.
I'll keep this issue open for now.
requiring babel-register is causing trouble when bundling this package using webpack for lambdas: https://github.com/arthanzel/evaluatex/blob/master/index.js#L8
Module not found: Error: Can't resolve 'babel-register' in 'app/node_modules/evaluatex'
Module not found: Error: Can't resolve './src/evaluatex' in 'app/node_modules/evaluatex'
can we only keep the transpiled code? and avoid transpiling on the fly?