@meteorjs/rspack 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/meteorRspackHelpers.js +5 -13
- package/package.json +1 -1
|
@@ -2,18 +2,6 @@ const path = require("path");
|
|
|
2
2
|
const { prepareMeteorRspackConfig } = require("./meteorRspackConfigFactory");
|
|
3
3
|
const { builtinModules } = require("module");
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Resolve a package directory from node resolution.
|
|
7
|
-
* @param {string} pkg
|
|
8
|
-
* @returns {string} absolute directory of the package
|
|
9
|
-
*/
|
|
10
|
-
function pkgDir(pkg) {
|
|
11
|
-
const resolved = require.resolve(`${pkg}/package.json`, {
|
|
12
|
-
paths: [process.cwd()],
|
|
13
|
-
});
|
|
14
|
-
return path.dirname(resolved);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
5
|
/**
|
|
18
6
|
* Wrap externals for Meteor runtime (marks deps as externals).
|
|
19
7
|
* Usage: compileWithMeteor(["sharp", "vimeo", "fs"])
|
|
@@ -38,7 +26,11 @@ function compileWithMeteor(deps) {
|
|
|
38
26
|
* @returns {Record<string, object>} `{ meteorRspackConfigX: { module: { rules: [...] } } }`
|
|
39
27
|
*/
|
|
40
28
|
function compileWithRspack(deps, { options = {} } = {}) {
|
|
41
|
-
const includeDirs = deps.flat().filter(Boolean)
|
|
29
|
+
const includeDirs = deps.flat().filter(Boolean)
|
|
30
|
+
.map(pkg => typeof pkg === 'string' && !pkg.includes('node_modules')
|
|
31
|
+
? path.join(process.cwd(), 'node_modules', pkg)
|
|
32
|
+
: pkg
|
|
33
|
+
);
|
|
42
34
|
|
|
43
35
|
return prepareMeteorRspackConfig({
|
|
44
36
|
module: {
|