It says in the README for Froala how you use it with ES6. Nowhere do I see the import path you're using. The reason you're seeing N is not defined is that Laravel imports the JavaScript as modules, so you need to use <script type="module"> and not <script>.
Also, if you're only going to use Froala in one place it'd be better to create its own file for it, say froala.js or something:
import FroalaEditor from 'froala-editor';
import 'froala-editor/css/froala_editor.min.css';
window.FroalaEditor = FroalaEditor;
Then you need to add that as an input to your vite.config.js file:
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/js/froala.js'
],
refresh: true,
}),
],
});
And then for every page you need to use Froala, you add it to the @vite directives array. Vite will automatically separate the JavaScript and CSS into its own files and all you have to do is reference the input file:
@vite(['resources/css/app.css', 'resources/js/app.js', 'resources/js/froala.js'])
Lastly, you can use it by initializing a new editor where you need it:
<body>
<textarea></textarea>
<script type="module">
new FroalaEditor('textarea');
</script>
</body>