2020-04-26 20:33:39 +00:00
|
|
|
const path = require('path');
|
2021-05-12 06:35:00 +00:00
|
|
|
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
|
|
|
|
const styledComponentsTransformer = createStyledComponentsTransformer();
|
2020-04-26 20:33:39 +00:00
|
|
|
|
2021-05-12 06:35:00 +00:00
|
|
|
/** @type { import('webpack').Configuration } */
|
2020-04-26 20:33:39 +00:00
|
|
|
module.exports = {
|
2021-05-12 06:35:00 +00:00
|
|
|
entry: { index: './src/index.ts' },
|
2020-04-26 20:33:39 +00:00
|
|
|
target: 'web',
|
|
|
|
output: {
|
2020-06-16 19:46:13 +00:00
|
|
|
path: path.resolve(__dirname, '../dist'),
|
2020-04-26 20:33:39 +00:00
|
|
|
filename: '[name].js',
|
2020-06-16 19:46:13 +00:00
|
|
|
sourceMapFilename: '[name].js.map',
|
2020-04-26 20:33:39 +00:00
|
|
|
library: 'insomniaComponents',
|
|
|
|
libraryTarget: 'commonjs2',
|
|
|
|
},
|
2021-05-12 06:35:00 +00:00
|
|
|
optimization: {
|
|
|
|
// Disable minification for now, otherwise smoke tests fail
|
|
|
|
// Note, minification is disabled in insomnia-app as well
|
|
|
|
minimize: false,
|
|
|
|
},
|
2020-04-26 20:33:39 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2021-05-12 06:35:00 +00:00
|
|
|
test: /\.tsx?$/,
|
|
|
|
loader: 'ts-loader',
|
|
|
|
exclude: [/node_modules/],
|
|
|
|
options: {
|
|
|
|
configFile: 'tsconfig.build.json',
|
|
|
|
getCustomTransformers: () => ({ before: [styledComponentsTransformer] }),
|
2020-04-26 20:33:39 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-05-12 06:35:00 +00:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.json', '.ts', '.tsx'],
|
|
|
|
},
|
|
|
|
externals: ['react', 'react-dom', 'styled-components'],
|
2020-04-26 20:33:39 +00:00
|
|
|
};
|