@@ -2,70 +2,67 @@ import svelte from 'rollup-plugin-svelte';
2
2
import resolve from '@rollup/plugin-node-resolve' ;
3
3
import commonjs from '@rollup/plugin-commonjs' ;
4
4
import livereload from 'rollup-plugin-livereload' ;
5
- import { terser } from 'rollup-plugin-terser' ;
5
+ import {
6
+ terser
7
+ } from 'rollup-plugin-terser' ;
6
8
7
9
const production = ! process . env . ROLLUP_WATCH ;
8
10
9
11
export default {
10
- input : 'src/main.js' ,
11
- output : {
12
- sourcemap : true ,
13
- format : 'iife' ,
14
- name : 'app' ,
15
- file : 'public/build/bundle.js'
16
- } ,
17
- plugins : [
18
- svelte ( {
19
- // enable run-time checks when not in production
20
- dev : ! production ,
21
- // we'll extract any component CSS out into
22
- // a separate file - better for performance
23
- css : css => {
24
- css . write ( 'public/build/bundle.css' ) ;
25
- }
26
- } ) ,
12
+ input : 'src/main.js' ,
13
+ output : {
14
+ sourcemap : true ,
15
+ format : 'iife' ,
16
+ name : 'app' ,
17
+ file : 'public/build/bundle.js'
18
+ } ,
19
+ plugins : [
20
+ svelte ( {
21
+ customElement : true ,
22
+ dev : ! production ,
23
+ } ) ,
27
24
28
- // If you have external dependencies installed from
29
- // npm, you'll most likely need these plugins. In
30
- // some cases you'll need additional configuration -
31
- // consult the documentation for details:
32
- // https://github.com/rollup/plugins/tree/master/packages/commonjs
33
- resolve ( {
34
- browser : true ,
35
- dedupe : [ 'svelte' ]
36
- } ) ,
37
- commonjs ( ) ,
25
+ // If you have external dependencies installed from
26
+ // npm, you'll most likely need these plugins. In
27
+ // some cases you'll need additional configuration -
28
+ // consult the documentation for details:
29
+ // https://github.com/rollup/plugins/tree/master/packages/commonjs
30
+ resolve ( {
31
+ browser : true ,
32
+ dedupe : [ 'svelte' ]
33
+ } ) ,
34
+ commonjs ( ) ,
38
35
39
- // In dev mode, call `npm run start` once
40
- // the bundle has been generated
41
- ! production && serve ( ) ,
36
+ // In dev mode, call `npm run start` once
37
+ // the bundle has been generated
38
+ ! production && serve ( ) ,
42
39
43
- // Watch the `public` directory and refresh the
44
- // browser on changes when not in production
45
- ! production && livereload ( 'public' ) ,
40
+ // Watch the `public` directory and refresh the
41
+ // browser on changes when not in production
42
+ ! production && livereload ( 'public' ) ,
46
43
47
- // If we're building for production (npm run build
48
- // instead of npm run dev), minify
49
- production && terser ( )
50
- ] ,
51
- watch : {
52
- clearScreen : false
53
- }
44
+ // If we're building for production (npm run build
45
+ // instead of npm run dev), minify
46
+ production && terser ( )
47
+ ] ,
48
+ watch : {
49
+ clearScreen : false
50
+ }
54
51
} ;
55
52
56
53
function serve ( ) {
57
- let started = false ;
54
+ let started = false ;
58
55
59
- return {
60
- writeBundle ( ) {
61
- if ( ! started ) {
62
- started = true ;
56
+ return {
57
+ writeBundle ( ) {
58
+ if ( ! started ) {
59
+ started = true ;
63
60
64
- require ( 'child_process' ) . spawn ( 'npm' , [ 'run' , 'start' , '--' , '--dev' ] , {
65
- stdio : [ 'ignore' , 'inherit' , 'inherit' ] ,
66
- shell : true
67
- } ) ;
68
- }
69
- }
70
- } ;
71
- }
61
+ require ( 'child_process' ) . spawn ( 'npm' , [ 'run' , 'start' , '--' , '--dev' ] , {
62
+ stdio : [ 'ignore' , 'inherit' , 'inherit' ] ,
63
+ shell : true
64
+ } ) ;
65
+ }
66
+ }
67
+ } ;
68
+ }
0 commit comments