nitrostack 1.0.6 → 1.0.8

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/CHANGELOG.md CHANGED
@@ -8,6 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.0.7] - 2025-10-27
12
+
13
+ ### Fixed
14
+ - **Critical**: Fixed webpack loader configuration error for Studio
15
+ - Switched from manual `next-swc-loader` configuration to Next.js's `defaultLoaders.babel`
16
+ - Resolves "TypeError [ERR_INVALID_ARG_TYPE]: The 'from' argument must be of type string" error
17
+ - Uses Next.js's pre-configured loader with all correct options
18
+
19
+ ### Technical Details
20
+ - Previous manual loader configuration was passing incorrect options to `next-swc-loader`
21
+ - New approach: use `defaultLoaders.babel` provided by Next.js webpack context
22
+ - This ensures all TypeScript/JSX files in `lib/` and `components/` are processed with the correct Babel/SWC configuration
23
+
11
24
  ## [1.0.6] - 2025-10-27
12
25
 
13
26
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitrostack",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "NitroStack - Build powerful MCP servers with TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/core/index.js",
@@ -105,4 +105,4 @@
105
105
  "url": "https://github.com/abhishekpanditofficial/nitrostack/issues"
106
106
  },
107
107
  "homepage": "https://nitrostack.vercel.app"
108
- }
108
+ }
@@ -16,33 +16,46 @@ const nextConfig = {
16
16
  eslint: {
17
17
  ignoreDuringBuilds: true,
18
18
  },
19
- webpack: (config, { isServer }) => {
19
+ transpilePackages: ['nitrostack'],
20
+ webpack: (config) => {
20
21
  // Explicitly configure webpack to resolve @ alias
21
22
  config.resolve.alias = {
22
23
  ...config.resolve.alias,
23
24
  '@': __dirname,
24
25
  };
25
26
 
26
- // Ensure our lib and components directories are included in compilation
27
- // This is needed when Studio is running from node_modules
28
- const libPath = path.join(__dirname, 'lib');
29
- const componentsPath = path.join(__dirname, 'components');
27
+ const libPath = path.resolve(__dirname, 'lib');
28
+ const componentsPath = path.resolve(__dirname, 'components');
30
29
 
31
- // Add a new rule specifically for our TypeScript files
30
+ // Create a high-priority rule that ensures TS/TSX in node_modules/nitrostack are transpiled
31
+ const forceTsTranspileRule = {
32
+ test: /\.(ts|tsx)$/,
33
+ // Do not exclude our package even if under node_modules
34
+ exclude: (modulePath) => {
35
+ // Never exclude files from nitrostack package
36
+ if (modulePath.includes(`${path.sep}node_modules${path.sep}nitrostack${path.sep}`)) {
37
+ return false;
38
+ }
39
+ // Otherwise, apply default exclude for node_modules
40
+ return modulePath.includes(`${path.sep}node_modules${path.sep}`);
41
+ },
42
+ use: {
43
+ loader: require.resolve('next/dist/build/webpack/loaders/next-swc-loader'),
44
+ },
45
+ };
46
+
47
+ const oneOfRule = config.module.rules.find((rule) => Array.isArray(rule.oneOf));
48
+ if (oneOfRule && Array.isArray(oneOfRule.oneOf)) {
49
+ oneOfRule.oneOf.unshift(forceTsTranspileRule);
50
+ } else {
51
+ config.module.rules.unshift(forceTsTranspileRule);
52
+ }
53
+
54
+ // Also add a specific include-based rule for our lib/components as a fallback
32
55
  config.module.rules.push({
33
56
  test: /\.(ts|tsx)$/,
34
57
  include: [libPath, componentsPath],
35
- use: [
36
- {
37
- loader: 'next-swc-loader',
38
- options: {
39
- isServer,
40
- pagesDir: path.join(__dirname, 'app'),
41
- appDir: path.join(__dirname, 'app'),
42
- hasReactRefresh: !isServer,
43
- },
44
- },
45
- ],
58
+ use: require.resolve('next/dist/build/webpack/loaders/next-swc-loader'),
46
59
  });
47
60
 
48
61
  return config;