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

Js build update #163

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Give it a try in [this jsFiddle](https://jsfiddle.net/felixmariotto/y81rf5t2/44/
Using react-three-fiber ? Here is a [codesandbox](https://codesandbox.io/s/react-three-mesh-ui-forked-v7n0b?file=/src/index.js) to get started.

## Import
### JSM
**With NPM and ES6 :**
In your console : `npm install three-mesh-ui`
```javascript
Expand All @@ -51,11 +52,30 @@ In your console : `npm install three-mesh-ui`
const ThreeMeshUI = require('three-mesh-ui');
```

**With HTML <script> tag :**
**With HTML &lt;script&gt; tag :**
```html
<script type="module">
import * as THREE from 'https://cdn.skypack.dev/three@<version>';
import * ThreeMeshUI from 'not-available-at-the-moment';
// We currently didn't have a bundled jsm file :,(
// Please be welcome to contribute if this is something you use. :)
</script>
```


### JS
**With HTML &lt;script&gt; tag :**
```html
<!-- threejs is not anymore include in the three-mesh-ui bundle -->
<!-- you must then load the three dependency -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js'></script>
<!-- before loading three-mesh-ui -->
<script src='https://unpkg.com/three-mesh-ui'></script>
```

*Although this would theorically allows you to build 'something', loading js libraries instead of using jsm, might restrict the global features you would have. This is true for both three and three-mesh-ui libraries.*


## Font files

In order to display some text with three-mesh-ui, you will need to provide font files.
Expand Down
5 changes: 4 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ module.exports = env => {
filename: '[name].js',
library: 'ThreeMeshUI',
libraryTarget: 'umd'
},
externals: {
three:'THREE'
}

}

}
}