question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛parcel lays a brick when trying to build with error: "template is not a function"

See original GitHub issue

index.html:

<!DOCTYPE html>
<html lang="en">
    <head>
    </head>

    <body>
        <script src="./index.tsx"></script>
    </body>
</html>

index.tsx contains proprietary code that compiles and runs fine with webpack.

Relevant error message in totality (with index.html directory stripped just because):

index.html: template is not a function
    at Object.<anonymous> (C:\Users\Oliver\AppData\Local\Yarn\config\global\node_modules\parcel-bundler\src\visitors\dependencies.js:7:25)
    at Module._compile (C:\Users\Oliver\AppData\Local\Yarn\config\global\node_modules\v8-compile-cache\v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (C:\Users\Oliver\AppData\Local\Yarn\config\global\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (C:\Users\Oliver\AppData\Local\Yarn\config\global\node_modules\parcel-bundler\src\assets\JSAsset.js:4:29)
    at Module._compile (C:\Users\Oliver\AppData\Local\Yarn\config\global\node_modules\v8-compile-cache\v8-compile-cache.js:178:30)
Software Version(s)
Parcel 1.4.1
Node 8.9.4
npm/Yarn yarn 1.3.2
Operating System Windows 10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
craftytrickstercommented, Jan 25, 2018

@DeMoorJasper , --no-source-maps does eliminate the error I was getting. Unfortunately now, it says Building random-file.js for about 40 files and then it begins to hang with no further output/work.

0reactions
fu5hacommented, Feb 2, 2018

Fixed on my machine by adding babel-template and babel-types to parcel’s package.json. Not sure if this is indicative of some other larger issue, but submitted a PR that can be reviewed as far as that goes. For a temporary fix, you can try just editing your local copy like I did.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when invoking a dataflow flex template from a Python ...
Hmm, looks like there is a separate endpoint/call for running flex templates: docs. This worked for me: dataflow = build('dataflow', 'v1b3', ...
Read more >
Distance Education for Teacher Training: Modes, Models, and ...
The often overlooked bottom line in distance education is not the policy ... Widgets are gaining increasing attention as a stand-alone multimedia tool...
Read more >
Ticket: # 705801 - unsolicited email advertising Description
When I try to unsubscribe, the verification code that I type in is rejected. I believe this is a scam and a way...
Read more >
Public Assistance Program and Policy Guide V3.1 - FEMA
FEMA will evaluate such requests based on damage and costs not covered under the ... FEMA refers to these components as the building...
Read more >
Lots of Ways to Use Math.random() in JavaScript - CSS-Tricks
Math.random() is an API in JavaScript. It is a function that gives you a random number. The number returned will be between 0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found