The right way to create Vue components that rely on parent build tools

I suppose this problem will be applicable to other frameworks that have few ecosystems of plugins / components that rely on specific building tools (React components with JSX, etc.). Vue is just my use case.

I created several Vue components as separate files .vuethat are published to NPM. package.jsonthis component does not list any dependencies, since they themselves are designed to work in the parent project, which uses webpack, vue-loader, sass-loader, etc. This is an example of one of these components .

I'm not sure of the best way to declare that these components rely on the parent package with the specified build tools. I’m not sure what devDependenciesis the right place for them, since the component itself does not have a development step that relies on them. peerDependenciesseems to be more appropriate, but again I’m not sure if this correctly matches what I am trying to achieve.

Looking through many components in awesome-vue , I see no use peerDependenciesand devDependenciesseem relevant for the development of specific components themselves.

What is the correct way to create these components? It's almost like I need something like " peerDevDependencies".

+6
3

, , .

, main raw .vue .

, - , , , , , Browserify Rollup ( Webpack). raw .vue .vue , , Vue, ( ).

, , , , Vue <script>. , , Vue peerDependency , .

package.json, CDN , , , .

+1

Vue.js, , peerDependencies . , , , . devDependencies , .

0

"module" package.json raw vue "main" . module - , , webpack rollup .

. s npm.

-1

Source: https://habr.com/ru/post/1015951/


All Articles