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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate Backpack components into an existing project #183

Closed
Nerogee opened this issue Oct 10, 2017 · 4 comments
Closed

How to integrate Backpack components into an existing project #183

Nerogee opened this issue Oct 10, 2017 · 4 comments

Comments

@Nerogee
Copy link

Nerogee commented Oct 10, 2017

This is a question instead of reporting a bug. Since there is less resource I can seek for help, so I put my question here.

Note: If you are looking to integrate Backpack components into an existing project, be aware that components are published uncompiled which means you'll need to accommodate for this in your webpack config.

I'm trying to integrate backpage into an existing project. But it fails
image

I think I miss some important step as what it mentions in note. Can anyone advise me how to accommodate for this in my webpack config?

@matthewdavidson
Copy link
Contributor

Hi @Nerogee! Have a look at backpack-react-scripts - it's a fork of Facebook's Create React App with tweaks to the webpack configuration in order to support backpack components out of the box.

You can check out the webpack configuration inside (have a look in the dev and prod configs). Essentially we have added in a custom regex to include backpack components in babel-loader as well as sass compilation support. See this guide for more details.

Hope this helps!

@matthewdavidson
Copy link
Contributor

Closing due to inactivity - feel free to reopen if you need info!

@georgegillams
Copy link
Contributor

Hey @Nerogee

I appreciate it's a while since you raised this, so might not be at all relevant, but I've published an experimental package called backpack-transpiled which contains all the backpack React components, and uses transpiled js and CSS.

You can check it out here.
https://www.npmjs.com/package/backpack-transpiled

Usage is the same as documented on backpack.github.io, except you have to import from subdirectories within the package. eg:

import BpkButton from 'backpack-transpiled/bpk-component-button';

As I said it's experimental for now, and not officially supported by Backpack or Skyscanner, but it might help 🤷

@Amantel
Copy link

Amantel commented Jan 10, 2022

This is kinda sad that there are no guides (at least I have found none) that can help in this task. Most links from @matthewdavidson comment do not work at this point.
There is one webpack config now, but personally I have no idea what part of it should I merge to the nextjs one we are using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants