update package, rollup config and use export in main

This commit is contained in:
Anton Heryanto Hasan 2017-09-08 14:54:24 +08:00
parent a15721468f
commit 222cadda5d
3 changed files with 15 additions and 10 deletions

View file

@ -2,13 +2,12 @@
"name": "svelte-app", "name": "svelte-app",
"version": "1.0.0", "version": "1.0.0",
"devDependencies": { "devDependencies": {
"rollup": "^0.47.6", "rollup": "^0.49.3",
"rollup-plugin-buble": "^0.15.0", "rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.1.0", "rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-svelte": "^3.1.0", "rollup-plugin-svelte": "^3.1.0",
"rollup-plugin-uglify": "^2.0.1", "rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.3.1",
"serve": "^6.0.6" "serve": "^6.0.6"
}, },
"scripts": { "scripts": {

View file

@ -7,13 +7,17 @@ import uglify from 'rollup-plugin-uglify';
const production = !process.env.ROLLUP_WATCH; const production = !process.env.ROLLUP_WATCH;
export default { export default {
entry: 'src/main.js', input: 'src/main.js',
dest: 'public/bundle.js', output: {
sourcemap: true,
format: 'iife', format: 'iife',
moduleName: 'app', file: 'public/bundle.js'
sourceMap: true, },
name: 'app',
plugins: [ plugins: [
svelte({ svelte({
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into // we'll extract any component CSS out into
// a separate file — better for performance // a separate file — better for performance
css: css => { css: css => {

View file

@ -1,8 +1,10 @@
import App from './App.html'; import App from './App.html';
window.app = new App({ const app = new App({
target: document.body, target: document.body,
data: { data: {
name: 'world' name: 'world'
} }
}); });
export default app;