Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch to Vite #35

Merged
merged 4 commits into from
Aug 10, 2022
Merged

feat: switch to Vite #35

merged 4 commits into from
Aug 10, 2022

Conversation

aarthificial
Copy link
Contributor

No description provided.

aarthificial and others added 4 commits August 9, 2022 19:37
This PR replaces webpack with Vite and restructures the project
to prepare for bundling animations in the future.

BREAKING CHANGE: change the overall structure of a project

`vite` and `@motion-canvas/vite-plugin` packages are now required to build a project:
```
npm i -D vite @motion-canvas/vite-plugin
```
The following `vite.config.ts` file needs to be created in the root of the project:
```ts
import {defineConfig} from 'vite';
import motionCanvas from '@motion-canvas/vite-plugin';

export default defineConfig({
  plugins: [motionCanvas()],
});
```

Types exposed by Motion Canvas are no longer global.
An additional `motion-canvas.d.ts` file needs to be created in the `src` directory:
```ts
/// <reference types="@motion-canvas/core/project" />
```

 Finally, the `bootstrap` function no longer exists.
 Project files should export an instance of the `Project` class instead:
 ```ts
 import '@motion-canvas/core/lib/patches';
 import {Project} from '@motion-canvas/core/lib';

 import example from './scenes/example.scene';

 export default new Project({
   name: 'project',
   scenes: [example],
   // same options as in bootstrap() are available:
   background: '#141414',
 });
 ```

Closes: #13
@aarthificial aarthificial merged commit aa3abe7 into motion-canvas:alpha Aug 10, 2022
This was referenced Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant