fix: react entry
This commit is contained in:
parent
3aca5913bc
commit
9d56138104
|
@ -22,6 +22,8 @@ module.exports = () => (neutrino) => {
|
||||||
join(process.cwd(), 'node_modules'),
|
join(process.cwd(), 'node_modules'),
|
||||||
'node_modules',
|
'node_modules',
|
||||||
]);
|
]);
|
||||||
|
neutrino.options.appRoot = neutrino.options.root;
|
||||||
|
neutrino.options.appSource = join(neutrino.options.appRoot, 'src');
|
||||||
const root = join(__dirname, '..', '..');
|
const root = join(__dirname, '..', '..');
|
||||||
neutrino.options.root = fs.realpathSync(root);
|
neutrino.options.root = fs.realpathSync(root);
|
||||||
neutrino.options.source = 'client';
|
neutrino.options.source = 'client';
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const react = require('./react');
|
const react = require('./react');
|
||||||
|
|
||||||
module.exports = (config) => {
|
module.exports = (config, latus) => {
|
||||||
const webIndex = config.use.findIndex((m) => m.isWebMiddleware);
|
const webIndex = config.use.findIndex((m) => m.isWebMiddleware);
|
||||||
if (-1 !== webIndex) {
|
if (-1 !== webIndex) {
|
||||||
config.use.splice(webIndex, 1, react());
|
config.use.splice(webIndex, 1, react(latus));
|
||||||
}
|
}
|
||||||
config.use.push((neutrino) => {
|
config.use.push((neutrino) => {
|
||||||
[
|
[
|
||||||
|
|
17
packages/react/src/build/react.js
vendored
17
packages/react/src/build/react.js
vendored
|
@ -1,4 +1,8 @@
|
||||||
const {dirname} = require('path');
|
const {
|
||||||
|
dirname,
|
||||||
|
isAbsolute,
|
||||||
|
join,
|
||||||
|
} = require('path');
|
||||||
|
|
||||||
const {require: R} = require('@latus/core');
|
const {require: R} = require('@latus/core');
|
||||||
const react = require('@neutrinojs/react');
|
const react = require('@neutrinojs/react');
|
||||||
|
@ -9,7 +13,7 @@ const {
|
||||||
LATUS_POSTCSS_CONFIG = resolve('@latus/build/build/postcss.config.js'),
|
LATUS_POSTCSS_CONFIG = resolve('@latus/build/build/postcss.config.js'),
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
module.exports = () => (neutrino) => {
|
module.exports = (latus) => (neutrino) => {
|
||||||
react({
|
react({
|
||||||
babel: {
|
babel: {
|
||||||
configFile: LATUS_BABEL_CONFIG,
|
configFile: LATUS_BABEL_CONFIG,
|
||||||
|
@ -43,5 +47,12 @@ module.exports = () => (neutrino) => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})(neutrino);
|
})(neutrino);
|
||||||
neutrino.config.module.rule('compile').include.add(`${process.cwd()}/src`);
|
const {entry} = latus.get('@latus/react');
|
||||||
|
neutrino.config.module
|
||||||
|
.rule('compile').include
|
||||||
|
.add(
|
||||||
|
isAbsolute(entry)
|
||||||
|
? entry
|
||||||
|
: join(neutrino.options.appSource, entry),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,8 +2,8 @@ const httpBuild = require('./build/http');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
hooks: {
|
||||||
'@latus/http/build': (config) => {
|
'@latus/http/build': (config, latus) => {
|
||||||
httpBuild(config);
|
httpBuild(config, latus);
|
||||||
},
|
},
|
||||||
'@latus/http/plugins': (req, {
|
'@latus/http/plugins': (req, {
|
||||||
config: {'@latus/react': {entry}},
|
config: {'@latus/react': {entry}},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user