feat: humus

This commit is contained in:
cha0s 2020-06-18 07:52:38 -05:00
parent c84caf601e
commit 2c9fe3a1a7
3 changed files with 27 additions and 5 deletions

View File

@ -2,6 +2,7 @@ const path = require('path');
const react = require('@neutrinojs/react'); const react = require('@neutrinojs/react');
const styles = require('@neutrinojs/style-loader'); const styles = require('@neutrinojs/style-loader');
const globImporter = require('node-sass-glob-importer'); const globImporter = require('node-sass-glob-importer');
const scwp = require('scwp/neutrino');
const {DefinePlugin} = require('webpack'); const {DefinePlugin} = require('webpack');
const {afterPlatform, initial} = require('./middleware'); const {afterPlatform, initial} = require('./middleware');
@ -13,7 +14,13 @@ module.exports = {
use: [ use: [
initial({ initial({
environmentDefines: ['FRONTEND_ORIGIN'], environmentDefines: ['FRONTEND_ORIGIN'],
scwpPaths: [/^@avocado/], rawScwpPaths: [
`${__dirname}/../humus/src/common`,
`${__dirname}/../humus/src/server`,
],
scwpPaths: [
/^@avocado/,
],
}), }),
react({ react({
devServer: { devServer: {
@ -47,7 +54,11 @@ module.exports = {
}, },
}), }),
afterPlatform({ afterPlatform({
babelPaths: [/^@avocado/, /^contempo/, /^scwp/], babelPaths: [
/^@avocado/,
`${__dirname}/../humus/src/common`,
`${__dirname}/../humus/src/server`,
],
}), }),
(neutrino) => { (neutrino) => {
neutrino.config.module.rule('style') neutrino.config.module.rule('style')

View File

@ -17,11 +17,19 @@ module.exports = {
use: [ use: [
initial({ initial({
environmentDefines: ['REDIS_ORIGIN'], environmentDefines: ['REDIS_ORIGIN'],
scwpPaths: [/^@avocado/], rawScwpPaths: [
`${__dirname}/../humus/src/common`,
`${__dirname}/../humus/src/server`,
],
scwpPaths: [
/^@avocado/,
],
}), }),
node(), node(),
afterPlatform({ afterPlatform({
babelPaths: [/^@avocado/], babelPaths: [
/^@avocado/,
],
externalMatcher: /(?:@avocado|@pixi|scwp|webpack)/, externalMatcher: /(?:@avocado|@pixi|scwp|webpack)/,
}), }),
(neutrino) => { (neutrino) => {

View File

@ -35,6 +35,7 @@ const gatherPackagePaths = (root, packageMatchers) => {
exports.initial = (options) => (neutrino) => { exports.initial = (options) => (neutrino) => {
const { const {
environmentDefines = [], environmentDefines = [],
rawScwpPaths = [],
scwpPaths = [], scwpPaths = [],
} = options; } = options;
neutrino.options.mains.index = `${side}/index`; neutrino.options.mains.index = `${side}/index`;
@ -60,7 +61,9 @@ exports.initial = (options) => (neutrino) => {
'./src/common', './src/common',
`./src/${side}`, `./src/${side}`,
].concat( ].concat(
gatherPackagePaths(neutrino.options.root, scwpPaths.concat(/^scwp/)) gatherPackagePaths(neutrino.options.root, scwpPaths.concat(/^scwp/)),
).concat(
rawScwpPaths,
), ),
})(neutrino); })(neutrino);
neutrino.config neutrino.config