Reputation: 63687
When attempting to use the reactstrap
package in an Electron boilerplate app by first installing the npm packages
npm install --save reactstrap react react-dom
npm install bootstrap --save
then importing the Bootstrap CSS in /app/renderer/app.js
import 'bootstrap/dist/css/bootstrap.min.css';
we are getting the error in the JS console
Uncaught SyntaxError: Unexpected token :
Removing the import
statement for bootstrap CSS removes the error, but the app ends up with no Bootstrap CSS styling.
Question: How can we get reactstrap
to work properly in an Electron app?
Upvotes: 4
Views: 660
Reputation: 3036
The basic electron setup doesn't understand CSS, therefor it fails at loading a CSS file.
Instead you could add the following line into the <head>
section of the .index.html
file:
<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css" />
The electron app (a special Chromium web browser instance) will load the CSS.
Upvotes: 1