ChristianPav's avatar

Can I publish JS library with laravel-mix?

Is there a way to use laravel-mix to publish a library to npm? It seems like I can't have a index.js file export a few files and have that be used in an npm package.

example:

// index.js - In library

export  * from './reuseablestuff';
// app.js - In Project

import {someFunc} from 'reusable-library';

someFunc();

But it seems the compiled file doesn't export anything. Is there a way to expose a library using mix?

0 likes
4 replies
Sinnbeck's avatar

What are you trying to export them for? Using them outside of your compiled scripts? If so, you need to bind them to window

ChristianPav's avatar

No, I'm trying to publish as a library and pull it in using private npm (Github packages).

ChristianPav's avatar

Nevermind I'm just going to use babel for the JS, and keep mix for the tailwind & scss.

Please or to participate in this conversation.