CodeKit
CodeKit copied to clipboard
url undefined when importing module - pass Prefer-Built-Ins: false || true
Quick, short summary:
I am attempting to import the npm module pixi.js. As soon as I do, I get the compilation error:
Bundled successfully, but with warnings: preferring built-in module 'url' over local alternative at '/node_modules/url/url.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.
When I refresh the browser, I get the console error:
`Uncaught ReferenceError: url is not defined` from PIXI, of which the node module `url` appears to be a dependency.
I am unsure of where or how to pass the `preferBuiltins` option with respect to codekit (or whether this will indeed solve my problem).
Expected results:
ability to import pixi.js via import * as PIXI from 'pixi.js' and have codekit bundle my javascript without error.
Actual results:
Console error in the browser, page does not load.
Exact steps to reproduce:
- Click on the cloud/download icon in codekit
- Type pixi.js into the search field
- Install the module via codekit
- In your javascript code, type
import * as PIXI from 'pixi.js(my file is called main.js) - Set the following options within codekit for main.js:
- ES6 bundle format: IIFE
- Check
minify the output - For "When this file changes", "compile it"
- Make sure your html page is loading the codekit-minified script
- View the console - see the error mentioned above:
Uncaught ReferenceError: url is not defined
A link to download a simplified project or file that shows the issue:
Your configuration (any details about your system that you think might be relevant)
The useBuiltIns option is not currently exposed in the UI but I can do that for the next update.
Actually, this IS exposed in the UI. It's under Babel because the option is related to transpiling and not bundling. false is the default value. Have you changed that?