@sprucelabs/babel-plugin-schema
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

babel-plugin-schema

This module ships with 2 components:

  1. When used with babel in a monorepo, it copies the @sprucelabs/spruce-schema module to the node_modules of the packages that need it so each project can utilize it's local path aliases.
  2. A resolve-path-aliases command that can resolve path aliases configured in your projects tsconfig.json.

Installing

yarn add @sprucelabs/babel-plugin-schema

Adding to Babel config in monorepo

Add @sprucelabs/babel-plugin-schema with the options exactly as is:

[
	"@sprucelabs/babel-plugin-schema",
	{ cwd: __dirname, destination: process.env.PWD },
];

Babel config example

module.exports = (api) => {
	api.cache(true);
	return {
		sourceMaps: true,
		presets: ["@babel/preset-env", "@babel/preset-typescript"],
		plugins: [
			[
				"@sprucelabs/babel-plugin-schema",
				{
					cwd: __dirname,
					destination: process.env.PWD,
				},
			],
			"@babel/plugin-transform-runtime",
			[
				"@babel/plugin-proposal-decorators",
				{
					legacy: true,
				},
			],
			["@babel/plugin-proposal-class-properties", { loose: true }],
			[
				"module-resolver",
				{
					root: ["./"],
					alias: {
						"#spruce": "./src/.spruce",
					},
				},
			],
		],
	};
};

Resolving path aliases

Readme

Keywords

none

Package Sidebar

Install

npm i @sprucelabs/babel-plugin-schema

Weekly Downloads

0

Version

4.0.1

License

MIT

Unpacked Size

133 kB

Total Files

35

Last publish

Collaborators

  • sprucelabs-ci
  • ryanrd
  • liquidg3