Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
chore: build the package with another target
Browse files Browse the repository at this point in the history
As it was asked in #39
This add a new target for building the package.
  • Loading branch information
GuillaumeOj committed Apr 6, 2021
1 parent e67a8fa commit 89e7c6f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"url": "https://github.com/Mergifyio/react-crisp"
},
"jest": {
"setupFilesAfterEnv": ["./jest.setup.js"]
"setupFilesAfterEnv": [
"./jest.setup.js"
]
},
"eslintConfig": {
"env": {
Expand Down Expand Up @@ -52,6 +54,7 @@
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"webpack": "^5.30.0",
"webpack-cli": "^4.2.0",
"webpack-module": "^0.1.0"
},
Expand Down
54 changes: 40 additions & 14 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,45 @@
const path = require('path');

module.exports = {
entry: './src/Crisp.jsx',
output: {
path: path.resolve('dist'),
filename: 'crisp.js',
libraryTarget: 'commonjs2',
module.exports = [
{
entry: './src/Crisp.jsx',
output: {
path: path.resolve(__dirname, './dist/web/'),
filename: 'crisp-web.js',
library: {
type: 'commonjs2',
},
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
},
],
},
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
{
entry: './src/Crisp.jsx',
experiments: {
outputModule: true,
},
output: {
path: path.resolve(__dirname, './dist/module/'),
filename: 'crisp-module.js',
library: {
type: 'module',
},
],
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
},
],
},
},
};
];

0 comments on commit 89e7c6f

Please sign in to comment.