mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 03:54:46 +00:00
move webpack config out of sapper, into the app
This commit is contained in:
7
lib/config.js
Normal file
7
lib/config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const path = require('path');
|
||||
|
||||
exports.dev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
exports.templates = path.resolve(process.env.SAPPER_TEMPLATES || 'templates');
|
||||
exports.src = path.resolve(process.env.SAPPER_ROUTES || 'routes');
|
||||
exports.dest = path.resolve(process.env.SAPPER_DEST || '.sapper');
|
||||
16
lib/route_manager.js
Normal file
16
lib/route_manager.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const glob = require('glob');
|
||||
const create_routes = require('../utils/create_routes.js');
|
||||
const { src } = require('./config.js');
|
||||
|
||||
const route_manager = {
|
||||
routes: create_routes(
|
||||
glob.sync('**/*.+(html|js|mjs)', { cwd: src })
|
||||
),
|
||||
|
||||
onchange(fn) {
|
||||
// TODO in dev mode, keep this updated, and allow
|
||||
// webpack compiler etc to hook into it
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = route_manager;
|
||||
Reference in New Issue
Block a user