UNPKG

@cogic/annotorious

Version:

A JavaScript image annotation library

77 lines (73 loc) 1.97 kB
const path = require('path'); const fs = require('fs'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const APP_DIR = fs.realpathSync(process.cwd()); const resolveAppPath = relativePath => path.resolve(APP_DIR, relativePath); module.exports = { entry: resolveAppPath('src'), output: { filename: 'annotorious.min.js', library: 'Annotorious', libraryTarget: 'umd', umdNamedDefine: true }, performance: { hints: false }, devtool: 'source-map', optimization: { minimize: true }, resolve: { extensions: ['.js', '.jsx'], alias: { 'react': 'preact/compat', 'react-dom': 'preact/compat', 'preact/compat': path.resolve(__dirname, 'node_modules', 'preact', 'compat'), 'preact/hooks': path.resolve(__dirname, 'node_modules', 'preact', 'hooks'), } }, module: { rules: [ { test: /\.(js|jsx)$/, use: { loader: 'babel-loader' , options: { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ [ "@babel/plugin-proposal-class-properties" ] ] } } }, { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, 'css-loader'] }, { test: /\.scss$/, use: [ MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader' ] } ] }, devServer: { compress: true, hot: true, host: process.env.HOST || 'localhost', port: 3000, static: { directory: resolveAppPath('public'), publicPath: '/' } }, plugins: [ new HtmlWebpackPlugin ({ inject: 'head', template: resolveAppPath('public/index.html') }), new MiniCssExtractPlugin({ filename: 'annotorious.min.css', }) ] }