mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 17:15:09 +08:00
a18122cfcb
* Update logo and favicon * Tiny updates * Replace checkbox with switch button * Build assets * Move assets/static to priv/static * Update lib/livebook_web/endpoint.ex Co-authored-by: José Valim <jose.valim@dashbit.co> Co-authored-by: José Valim <jose.valim@dashbit.co>
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
const path = require('path');
|
|
const glob = require('glob');
|
|
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
|
|
|
// Make sure NODE_ENV is set, so that @tailwindcss/jit is in watch mode in development.
|
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
|
|
module.exports = (env, options) => {
|
|
const devMode = options.mode !== 'production';
|
|
|
|
return {
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
|
|
new OptimizeCSSAssetsPlugin({})
|
|
]
|
|
},
|
|
entry: {
|
|
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
|
|
},
|
|
output: {
|
|
filename: '[name].js',
|
|
path: path.resolve(__dirname, (devMode ? '../priv/static_dev/js' : '../priv/static/js')),
|
|
publicPath: '/js/'
|
|
},
|
|
devtool: devMode ? 'eval-cheap-module-source-map' : undefined,
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader'
|
|
}
|
|
},
|
|
{
|
|
test: /\.[s]?css$/,
|
|
use: [
|
|
MiniCssExtractPlugin.loader,
|
|
'css-loader',
|
|
'postcss-loader',
|
|
],
|
|
},
|
|
{
|
|
test: /\.(ttf|woff|woff2|eot|svg)$/,
|
|
use: ['file-loader'],
|
|
},
|
|
]
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
|
new MonacoWebpackPlugin({
|
|
languages: ['markdown']
|
|
})
|
|
]
|
|
.concat(devMode ? [new HardSourceWebpackPlugin()] : [])
|
|
}
|
|
};
|