fix: require paths
This commit is contained in:
parent
3252f681a3
commit
43c0ac4609
|
@ -10,7 +10,7 @@ const r = eval('require');
|
|||
|
||||
(async () => {
|
||||
const config = readConfig();
|
||||
const paths = Object.entries(config).map(([plugin]) => {
|
||||
const paths = Object.keys(config).map((plugin) => {
|
||||
try {
|
||||
const local = join(process.cwd(), 'src', plugin);
|
||||
r.resolve(local);
|
||||
|
|
|
@ -9,14 +9,19 @@ export default class WebpackPlugin {
|
|||
}
|
||||
|
||||
apply(compiler) {
|
||||
const paths = Object.entries(this.config).map(([plugin]) => {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval('require')('@babel/register')({
|
||||
presets: ['@babel/preset-react'],
|
||||
});
|
||||
const paths = Object.keys(this.config).map((plugin) => {
|
||||
try {
|
||||
const local = join(process.cwd(), 'src', plugin);
|
||||
// eslint-disable-next-line no-eval
|
||||
eval('require.resolve')(plugin);
|
||||
return plugin;
|
||||
eval('require.resolve')(local);
|
||||
return local;
|
||||
}
|
||||
catch (error) {
|
||||
return join(process.cwd(), plugin);
|
||||
return plugin;
|
||||
}
|
||||
});
|
||||
const modules = paths.map((path) => `require('${path}')`).join(',');
|
||||
|
|
|
@ -42,7 +42,7 @@ const middleware = (neutrino) => {
|
|||
export default {
|
||||
hooks: {
|
||||
'@latus/core/config': () => ({
|
||||
entry: './src/react',
|
||||
entry: './react',
|
||||
}),
|
||||
'@latus/http/build': () => middleware,
|
||||
'@latus/http/plugins': (req, {config: {'@latus/react': {entry}}}) => ({
|
||||
|
|
Loading…
Reference in New Issue
Block a user