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.

Using app.import for browser-only packages

See original GitHub issue

At the minute, it doesn’t look like I can conditionally use app.import based on whether I’m building for the FastBoot build, or the browser build.

I’m trying to import a bower package that I’m only utilising inside didInsertElement.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BenKingBBCcommented, Mar 7, 2016

I’ve tried doing a conditional check against process.env.EMBER_CLI_FASTBOOT, but it appears that that applies for both the server-rendered app and the browser build. The app boots successfully, but on the client the JS starts throwing errors that the libraries do not exist.

Unless I am building the app wrong? With a clean directory I’m running ember fastboot --serve-assets.

0reactions
danmcclaincommented, Jan 27, 2017

Yes, the add on needs to be patched to conditionally call the import lines

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Import Browser Only Libraries Into Your Next.js ...
In this video we'll learn how to import browser only libraries into your Next.js apps. React has traditionally been a SPA framework that ......
Read more >
Importing a Browser Only Package Into Next.js - Ahmed Faaid
How to import a package that only works in the browser into Next.js ... We will create an app using create-next-app which will...
Read more >
Conditional import for browser-only dependencies #2035
Hello, I'm having an issue when trying to build a Gatsby app using amCharts. Minimal repro here. The issue appears to be caused...
Read more >
Docusaurus Client API
import BrowserOnly from '@docusaurus/BrowserOnly'; ... Returns true when the React app has successfully hydrated in the browser. caution.
Read more >
Module Constraints - Remix
A module side effect is code that executes by simply importing a module · You need to avoid any browser-only module side effects...
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