Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuraxdrumz/export-loader
a webpack loader that allowes to write Golang style exports
https://github.com/yuraxdrumz/export-loader
Last synced: 1 day ago
JSON representation
a webpack loader that allowes to write Golang style exports
- Host: GitHub
- URL: https://github.com/yuraxdrumz/export-loader
- Owner: yuraxdrumz
- Created: 2017-10-05T20:37:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-10T08:03:21.000Z (about 7 years ago)
- Last Synced: 2024-12-08T09:06:18.777Z (15 days ago)
- Language: HTML
- Homepage:
- Size: 146 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# export-loader
a webpack loader that allows to write Golang style exports as ES6 modules: all uppercase declarations get exported automatically for you.## usage
`npm i -D export-loader`
make sure you put export-loader before babel. Webpack reads loaders from right to left, so be sure to put it last as it will start first in order.
![instructions usage in webpack](https://i.imgur.com/mbwL1j0.png)### now you can use golang style imports:
![example usage in js](https://i.imgur.com/n9zYIoS.png)## what about existing exports and export default?
export default remains the same, if you want export default you have to explicitly write it.
existing export definitions will remain untouched.
es5 exports and module exports are ignored.
if you have ideas or features, you are welcomed to open them on github.### the loader will transform all uppercase variables to exports and simply append it to EOF
![end result](https://i.imgur.com/ghyPKbC.png)