react-dadata-suggestions-reactoutsideclick
Version:
Just another one react component for dadata suggestions
54 lines (52 loc) • 1.44 kB
JavaScript
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: ['./src/index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
libraryTarget: 'commonjs2' // THIS IS THE MOST IMPORTANT LINE! :mindblow: I wasted more than 2 days until realize this was the line most important in all this guide.
},
plugins: [
new MiniCssExtractPlugin({
filename: "styles.css",
disable: process.env.NODE_ENV === "development"
})
],
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src'),
exclude: /(node_modules|bower_components|dist)/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.less$|\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
hmr: process.env.NODE_ENV === 'development',
}
},
{
loader: "css-loader",
},
{
loader: "less-loader",
options: {
javascriptEnabled: true
}
}],
}
]
},
externals: {
// this line is just to use the React dependency of our
// parent-testing-project instead of using our own React.
'react': 'commonjs react'
}
};