cinch-collapsible
Version:
A simple lightweight react accordian component
57 lines (54 loc) • 1.35 kB
JavaScript
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const config = {
mode: "production",
entry: "./src/Collapsible/index.tsx",
output: {
filename: "index.js",
path: path.resolve(__dirname, "lib"),
libraryTarget: "commonjs2",
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {
react: path.resolve(__dirname, "./node_modules/react"),
"react-dom": path.resolve(__dirname, "./node_modules/react-dom"),
},
},
externals: {
// Don't bundle react or react-dom
react: {
commonjs: "react",
commonjs2: "react",
amd: "React",
root: "React",
},
"react-dom": {
commonjs: "react-dom",
commonjs2: "react-dom",
amd: "ReactDOM",
root: "ReactDOM",
},
},
module: {
rules: [
{
test: /(\.ts|\.tsx)$/,
loader: "ts-loader",
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
],
},
],
},
// plugins: [new HtmlWebpackPlugin({ template: "./src/index.html" })],
};
module.exports = config;