Skip to content

Commit b36f1ce

Browse files
kartsimsNataliaTepluhina
authored andcommitted
vuejs#2240 fix and updated versions for 'Packaging SFC' cookbook page (vuejs#2242)
1 parent e1b3f25 commit b36f1ce

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/v2/cookbook/packaging-sfc-for-npm.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ There is no need to write your module multiple times. It is possible to prepare
112112
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/my-component.min.js"
113113
},
114114
"devDependencies": {
115-
"rollup": "^0.57.1",
116-
"rollup-plugin-buble": "^0.19.2",
117-
"rollup-plugin-vue": "^3.0.0",
118-
"vue": "^2.5.16",
119-
"vue-template-compiler": "^2.5.16",
115+
"rollup": "^1.17.0",
116+
"rollup-plugin-buble": "^0.19.8",
117+
"rollup-plugin-commonjs": "^10.0.1",
118+
"rollup-plugin-vue": "^5.0.1",
119+
"vue": "^2.6.10",
120+
"vue-template-compiler": "^2.6.10"
120121
...
121122
},
122123
...
@@ -169,6 +170,7 @@ Notice the first line directly imports your SFC, and the last line exports it un
169170
With the package.json `scripts` section ready and the SFC wrapper in place, all that is left is to ensure Rollup is properly configured. Fortunately, this can be done with a small 16 line rollup.config.js file:
170171

171172
```js
173+
import commonjs from 'rollup-plugin-commonjs'; // Convert CommonJS modules to ES6
172174
import vue from 'rollup-plugin-vue'; // Handle .vue SFC files
173175
import buble from 'rollup-plugin-buble'; // Transpile/polyfill with reasonable browser support
174176
export default {
@@ -178,6 +180,7 @@ export default {
178180
exports: 'named',
179181
},
180182
plugins: [
183+
commonjs(),
181184
vue({
182185
css: true, // Dynamically inject css as a <style> tag
183186
compileTemplate: true, // Explicitly convert template to render function

0 commit comments

Comments
 (0)