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

Use rollup-plugin-consts for defining the build env

parent 7750f530
No related branches found
No related tags found
No related merge requests found
import environment from 'consts:environment';
var config;
switch(process.env.BUILD) {
switch(environment) {
case "development":
config = {
apiBaseUrl: 'https://mw-dev.tugraz.at',
......
......@@ -6,7 +6,7 @@ module.exports = function(config) {
basePath: 'dist',
frameworks: ['mocha', 'chai'],
files: [
'./bundle.js',
{pattern: './*.js', included: true, watched: true, served: true, type: 'module'},
{pattern: './**/*', included: false, watched: true, served: true},
],
autoWatch: true,
......
......@@ -13,10 +13,10 @@
"puppeteer": "^1.15.0",
"rollup": "^1.11.3",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-consts": "^1.0.1",
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-serve": "^1.0.1"
},
"scripts": {
......
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from "rollup-plugin-replace";
import multiEntry from 'rollup-plugin-multi-entry';
import copy from 'rollup-plugin-copy';
import serve from 'rollup-plugin-serve';
import consts from 'rollup-plugin-consts';
const pkg = require('./package.json');
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
......@@ -18,6 +18,9 @@ export default {
},
plugins: [
multiEntry(),
consts({
environment: build,
}),
resolve({
customResolveOptions: {
// ignore node_modules from vendored packages
......@@ -27,9 +30,6 @@ export default {
commonjs({
include: 'node_modules/**'
}),
replace({
"process.env.BUILD": '"' + build + '"',
}),
copy({
targets: [
{src: 'assets/index.html', dest: 'dist'},
......
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