skpm / with-webview

Template for skpm using a webview
40 stars 21 forks source link

How to load Bootstrap? #22

Open Jakobud opened 4 years ago

Jakobud commented 4 years ago

I'm having a hard time figuring out how to add Bootstrap to this. I tried just adding Bootstrap and jQuery via npm install bootstrap jquery and then doing import "bootstrap" in webview.js but that was causing all sorts of build errors.

Next I tried just manually adding the files to the resources folder:

resources/js/jquery.js
resources/js/popper.js
resources/js/bootstrap.js

I ensure that I add them to my resources array in package.json, but then I get the build error:

error Error while building resources/js/bootstrap.js
./resources/js/bootstrap.js
Module not found: Error: Can't resolve 'popper.js' in '/Users/jwilson/repos/sketch/font-auditor/resources/js'
resolve 'popper.js' in '/Users/jwilson/repos/sketch/font-auditor/resources/js'
  Parsed request is a module
  using description file: /Users/jwilson/repos/sketch/font-auditor/package.json (relative path: ./resources/js)
    Field 'sketch' doesn't contain a valid alias configuration
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
.... (about 100 more lines of stuff trace code)

Is there a simple example on how to add it?

lizheming commented 4 years ago

maybe https://github.com/skpm/sketch-module-web-view/issues/154 it can help you~