Skip to content

Instantly share code, notes, and snippets.

@weianofsteel
Created December 4, 2020 10:16
Show Gist options
  • Save weianofsteel/6cb2c8a2695a58de86200fd65e578292 to your computer and use it in GitHub Desktop.
Save weianofsteel/6cb2c8a2695a58de86200fd65e578292 to your computer and use it in GitHub Desktop.
ScrollUpBtn config
const path = require('path');
module.exports = {
mode: 'production',
entry: './src/ScrollUpButton.js',
output: {
path: path.resolve('lib'),
filename: 'ScrollUpButton.js',
libraryTarget: 'commonjs2',
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
}
],
},
resolve: {
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"
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment