Created
April 16, 2022 19:37
-
-
Save Mars073/7a92f8c1dc6e1de98c29f154cbe0f0ae to your computer and use it in GitHub Desktop.
How to use a module from a cdn in vue.js by importing it from a script tag, gist with the three.js library. Pro tip: you can install `@types/three` in devDependencies to have autocompletion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- ... --> | |
<script | |
src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js" | |
integrity="sha512-dLxUelApnYxpLt6K2iomGngnHO83iUvZytA3YjDUCjT0HDOHKXnVYdf3hU4JjM8uEhxf9nD1/ey98U3t2vZ0qQ==" | |
crossorigin="anonymous" | |
referrerpolicy="no-referrer" | |
></script> | |
</head> | |
<body> | |
<!-- ... --> | |
<div id="app"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { defineConfig } = require('@vue/cli-service') | |
module.exports = defineConfig({ | |
// ... | |
configureWebpack: { | |
externals: { | |
three: 'THREE' | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment