https://github.com/chasefleming/flow-cadence-plugin
Webpack plugin for Cadence and Flow.
https://github.com/chasefleming/flow-cadence-plugin
Last synced: over 1 year ago
JSON representation
Webpack plugin for Cadence and Flow.
- Host: GitHub
- URL: https://github.com/chasefleming/flow-cadence-plugin
- Owner: chasefleming
- Created: 2022-11-29T22:30:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T22:04:15.000Z (over 1 year ago)
- Last Synced: 2025-04-11T01:12:56.155Z (over 1 year ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webpack Plugin for Cadence Files on the Flow Blockchain
This plugin allows you to import `.cdc` Cadence files directly into your project, making Flow blockchain scripts and transactions easily accessible in a Webpack-based setup. Additionally, it resolves any TypeScript type errors for `.cdc` imports, providing smooth integration with TypeScript projects.
Let me know if you’d like further adjustments!
## Usage
```javascript
import ReadHelloWorld from '../cadence/scripts/ReadHelloWorld.cdc'
await fcl.query({
cadence: ReadHelloWorld
})
```
## Adding the Plugin
### Install
```bash
npm install flow-cadence-plugin --save-dev
```
### Webpack
To import `.cdc` files, add the plugin to your Webpack configuration:
```javascript
new FlowCadencePlugin()
```
### Next.js
To use the plugin in a Next.js project, add it to the Webpack configuration in `next.config.js`:
```javascript
import FlowCadencePlugin from 'flow-cadence-plugin'
module.exports = {
webpack: (config) => {
config.plugins.push(new FlowCadencePlugin())
return config
},
}
```