diff --git a/package.json b/package.json index b3ab607..e02c010 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,9 @@ "url": "https://github.com/Mergifyio/react-crisp" }, "jest": { - "setupFilesAfterEnv": ["./jest.setup.js"] + "setupFilesAfterEnv": [ + "./jest.setup.js" + ] }, "eslintConfig": { "env": { @@ -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" }, diff --git a/webpack.config.js b/webpack.config.js index cd6b926..fa9425b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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', + }, + ], + }, }, -}; +];