You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
results in a script that has ReferenceError: module is undefined on line 1 of the output.
this is precompiled purescript input -> which just means it's a commonjs module (with it's own commonjs dependancies) being imported into the following script:
import Main from './output/Main';
function main() {
const body = document.querySelector('body');
Array.from(body.children).forEach(element => {
body.removeChild(element);
});
const environment = process.env.ENVIRONMENT;
const apiUrl = process.env.API_URL;
Main.main(environment)(apiUrl)();
}
main();
the entry point is an html file that uses the js script above.
I've created a repo that reproduces this issue here: https://github.com/Benjmhart/parcelBugReproduction
the scripts are saved within npm and while the main source is written in purescript, npm scripts SHOULD make it pretty approachable without anyone needing to know any purescript or anything about how dependancies are being managed.
steps to reproduce:
clone the repo above
npm install
have parcel globally installed (i left parcel out of the dependancies list because if you are directly using source to test against this repo, you may want to swap out your version of parcel for mine.
run npm run build:treeshake to compile the code with treeshaking (see package.json for the exact arguments passed to parcel
run npm run serve to serve the built code. in your browser go to localhost:8000, you will see a blank page, open the console to see the error ReferenceError: module is not defined
if you want a baseline - you can follow the same directions as above but run npm run build:normal, which runs the same pipeline without tree shaking, running npm run serve and visiting the page thereafter will properly load the page contents.
🐛 bug report
running the following script
spago build && rm -rf ..//dist/* && parcel build index.html --no-source-maps --public-url ./ --out-dir ../dist
results in a script that has
ReferenceError: module is undefined
on line 1 of the output.this is precompiled purescript input -> which just means it's a commonjs module (with it's own commonjs dependancies) being imported into the following script:
the entry point is an html file that uses the js script above.
🎛 Configuration (.babelrc, package.json, cli command)
no babel configuration, cli command is
parcel build index.html --no-source-maps --public-url ./ --out-dir ../dist
🤔 Expected Behavior
it should replicate the behavior without tree shaking, which is the code should run without errors introduced by the bundling process
😯 Current Behavior
ReferenceError: module is undefined
on line 1 of the output💁 Possible Solution
🔦 Context
this increases the bundle size of our output by 400kb +
💻 Code Sample
🌍 Your Environment
Linux, 64 bit, xubuntu 18.04
The text was updated successfully, but these errors were encountered: