Created
November 9, 2018 13:08
-
-
Save stefanneculai/9c734689bc88c8931d18f187d6b5a94b to your computer and use it in GitHub Desktop.
Froala Editor with Webpack 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Froala with Webpack</title> | |
</head> | |
<body> | |
<div id="editor"></div> | |
<script src="dist/bundle.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $ = require('jquery'); | |
window.$ = $; | |
window.jQuery = $; | |
require('froala-editor/js/froala_editor.min.js'); | |
$('#editor').froalaEditor(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const webpack = require('webpack'); | |
module.exports = { | |
entry: './index.js', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: 'bundle.js' | |
}, | |
resolve: { | |
modules: ['node_modules'] | |
}, | |
plugins: [ | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery" | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@stefanneculai What would you recommend for a setup that minimizes its output? Webpack recommends using
TerserPlugin
and will apparently be including it as the default minimizer forwebpack@5
. It works fine for me withbut I'm really struggling with having custom plugins work (seeing a lot of(looks like usingt[n] is not a constructor
from froala)function
instead of() =>
syntax played a big role here).I'll consider opening an issue, butdo you have any recommendations for building for production with froala?