Skip to content
Snippets Groups Projects
Commit e1a8d409 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add code splitting and create a main and a demo bundle

parent 8900482c
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<script type="module" id="vpu-person-select-src" src="vpu-person-select.js"></script>
<script type="module" id="vpu-person-select-src" src="vpu-person-select-demo.js"></script>
</head>
<body>
......
......@@ -7,7 +7,7 @@ module.exports = function(config) {
basePath: 'dist',
frameworks: ['mocha', 'chai'],
files: [
{pattern: './' + pkg.name + '.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './*.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './**/*', included: false, watched: true, served: true},
],
autoWatch: true,
......
{
"name": "vpu-person-select",
"version": "1.0.0",
"main": "src/index.js",
"main": "src/vpu-person-select.js",
"devDependencies": {
"chai": "^4.2.0",
"i18next-scanner": "^2.10.2",
......@@ -22,6 +22,7 @@
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-url": "^2.2.2",
"rollup-plugin-delete": "^1.1.0",
"vpu-auth": "file:./vendor/auth",
"vpu-common": "file:./vendor/common"
},
......
......@@ -8,19 +8,25 @@ import serve from 'rollup-plugin-serve';
import multiEntry from 'rollup-plugin-multi-entry';
import url from "rollup-plugin-url"
import consts from 'rollup-plugin-consts';
import del from 'rollup-plugin-delete';
const pkg = require('./package.json');
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
console.log("build: " + build);
export default {
input: (build != 'test') ? 'src/demo.js' : 'test/**/*.js',
input: (build != 'test') ? ['src/vpu-person-select.js', 'src/vpu-person-select-demo.js'] : 'test/**/*.js',
output: {
file: 'dist/' + pkg.name + '.js',
format: 'esm'
dir: 'dist',
entryFileNames: '[name].js',
chunkFileNames: 'shared/[name].[hash].[format].js',
format: 'esm',
sourcemap: true
},
plugins: [
multiEntry(),
del({
targets: 'dist/*'
}),
(build == 'test') ? multiEntry() : false,
consts({
environment: build,
}),
......
import 'vpu-auth';
import './person-select-demo.js';
import './vpu-person-select-demo.js';
import 'vpu-auth';
import './person-select.js';
import 'vpu-auth';
import {i18n} from './i18n.js';
import {css, html, LitElement} from 'lit-element';
import './person-select.js';
import './vpu-person-select.js';
import * as commonUtils from 'vpu-common/utils';
import bulmaCSSPath from "bulma/css/bulma.min.css";
......
import '../src/person-select';
import '../src/demo';
import '../src/vpu-person-select.js';
import '../src/demo.js';
describe('vpu-person-select basics', () => {
let node;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment