반응형
vue 웹 팩에 바우어 구성 요소 추가
vue-webpack에 bower_components를 추가하는 방법이 있습니까?나는 그것이 작동하지 않는 방법을 시도했다.
webpack.base.conf.disc
http://pastebin.com/Gae193xP
컴포넌트 파일
<script type="text/babel">
import $ from 'jquery'
require('x-editable')
</script>
에러
라우터에서 패키지를 해결하려면 웹 팩 구성 파일을 구성해야 합니다.예를 들어 webpack.config.js에 있습니다.
module.exports = {
resolve: {
modulesDirectories: ["web_modules", "node_modules", "bower_components"]
},
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(".bower.json", ["main"])
)
]
}
https://webpack.github.io/docs/usage-with-bower.html 를 참조해 주세요.
스크립트 파일을 사용할 위치에서 로드해야 합니다.웹 팩이 로드하여 빌드에 포함합니다.js
<-- componentX.vue -->
...
<script lang="js">
import jquery from "../bower_components/jquery/jquery.js";
...
</script>
언급URL : https://stackoverflow.com/questions/41761881/adding-bower-components-to-vue-webpack
반응형
'programing' 카테고리의 다른 글
| 게치 및 화살표 코드 (0) | 2022.08.30 |
|---|---|
| 양방향 JPA OneToMany/ManyToOne 어소시에이션의 '어소시에이션의 역방향'이란 무엇입니까? (0) | 2022.08.30 |
| Vuex 상태 개체에서 키로 항목을 삭제할 때 getter에 바인딩된 계산된 속성이 업데이트되지 않음 (0) | 2022.08.29 |
| Mac에서 .c 파일을 컴파일하려면 어떻게 해야 합니까? (0) | 2022.08.29 |
| Vuex unregister Module의 기능은 무엇입니까? (0) | 2022.08.29 |