react-cookie-consent/webpack.config.js

38 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-11-02 19:17:06 +01:00
var path = require("path");
var CopyWebpackPlugin = require("copy-webpack-plugin");
2018-02-02 19:09:23 +01:00
module.exports = {
2020-11-02 19:17:06 +01:00
entry: "./src/index.js",
2018-02-02 19:09:23 +01:00
output: {
2020-11-02 19:17:06 +01:00
path: path.resolve(__dirname, "build"),
filename: "index.js",
library: {
name: "ReactCookieConsent",
type: "umd",
},
2021-02-19 10:40:58 +01:00
environment: {
arrowFunction: false, // the generated runtime-code should not use arrow functions
},
2021-12-11 11:13:55 +01:00
globalObject: `typeof self !== 'undefined' ? self : this`,
2018-02-02 19:09:23 +01:00
},
module: {
rules: [
{
test: /\.js$/,
2020-11-02 19:17:06 +01:00
include: path.resolve(__dirname, "src"),
exclude: /(node_modules|build)/,
2018-02-02 19:09:23 +01:00
use: {
2020-11-02 19:17:06 +01:00
loader: "babel-loader",
2018-02-02 19:09:23 +01:00
options: {
2020-11-02 19:17:06 +01:00
presets: ["@babel/preset-env"],
},
},
},
],
2018-02-02 19:09:23 +01:00
},
externals: {
2020-11-02 19:17:06 +01:00
react: "commonjs react", // this line is just to use the React dependency of our parent-testing-project instead of using our own React.
},
2020-11-02 19:17:06 +01:00
plugins: [new CopyWebpackPlugin({ patterns: [{ from: "src/index.d.ts", to: "index.d.ts" }] })],
};