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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.12.4 fails with "api.caller is not a function" when bundling an HTML file with a <style> tag #3746

Closed
n1313 opened this issue Nov 5, 2019 · 5 comments

Comments

@n1313
Copy link

n1313 commented Nov 5, 2019

馃悰 bug report

parcel v1.12.4 fails with "api.caller is not a function" when bundling an HTML file with a <style> tag.

馃帥 Configuration (.babelrc, package.json, cli command)

package.json:

{
  "name": "parcel",
  "version": "1.0.0",
  "description": "",
  "main": "index.html",
  "scripts": {
    "start": "parcel index.html --open"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "parcel-bundler": "^1.12.4"
  }
}

No other files except for index.html (see below). Running parcel by npm start.

馃 Expected Behavior

I should see a page in my browser.

馃槸 Current Behavior

Server fails with error message:

Server running at http://localhost:1234
馃毃  /path_to_my_repo/node_modules/parcel-bundler/src/builtins/css-loader.js: api.caller is not a function
    at /path_to_my_repo/node_modules/@babel/preset-env/lib/index.js:237:35
    at Object.default (/path_to_my_repo/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12)
    at getEnvPlugins (/path_to_my_repo/node_modules/parcel-bundler/src/transforms/babel/env.js:62:34)
    at getEnvConfig (/path_to_my_repo/node_modules/parcel-bundler/src/transforms/babel/env.js:12:25)
    at async getBabelConfig (/path_to_my_repo/node_modules/parcel-bundler/src/transforms/babel/config.js:32:19)
    at async babelTransform (/path_to_my_repo/node_modules/parcel-bundler/src/transforms/babel/transform.js:6:16)
    at async JSAsset.pretransform (/path_to_my_repo/node_modules/parcel-bundler/src/assets/JSAsset.js:83:5)
    at async JSAsset.process (/path_to_my_repo/node_modules/parcel-bundler/src/Asset.js:214:7)
    at async Pipeline.processAsset (/path_to_my_repo/node_modules/parcel-bundler/src/Pipeline.js:46:7)
    at async Pipeline.process (/path_to_my_repo/node_modules/parcel-bundler/src/Pipeline.js:24:23)

馃拋 Possible Solution

Removing the <style> tag fixes the problem.

馃捇 Code Sample

index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <style type="text/css">
      h1 {
        color: red;
      }
    </style>
  </head>

  <body>
    <h1>Parcel</h1>
  </body>
</html>

馃實 Your Environment

Software Version(s)
Parcel 1.12.4
Node 12.8.1
npm/Yarn npm 6.11.3
Operating System MacOS 10.14.6 (18G1012)
@lmachens
Copy link

lmachens commented Nov 5, 2019

Looks like it's related to latest babel update:
babel/babel#10649

@mischnic
Copy link
Member

mischnic commented Nov 5, 2019

@n1313 What version of @babel/preset-env are you using in this project?

@linychuo
Copy link

linychuo commented Nov 5, 2019

my terminal also prompt same error api.caller is not a function, My parcel version is 1.12.4

@n1313
Copy link
Author

n1313 commented Nov 5, 2019

@mischnic it's @babel/preset-env@7.7.0

@n1313
Copy link
Author

n1313 commented Nov 5, 2019

@mischnic removing node_modules and reinstalling to get @babel/preset-env@7.7.1 installed fixed the problem. Thanks!

@n1313 n1313 closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants