insomnia/packages/insomnia-components/webpack/webpack.common.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-04-26 20:33:39 +00:00
const path = require('path');
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
const styledComponentsTransformer = createStyledComponentsTransformer();
2020-04-26 20:33:39 +00:00
/** @type { import('webpack').Configuration } */
2020-04-26 20:33:39 +00:00
module.exports = {
entry: { index: './src/index.ts' },
2020-04-26 20:33:39 +00:00
target: 'web',
output: {
path: path.resolve(__dirname, '../dist'),
2020-04-26 20:33:39 +00:00
filename: '[name].js',
sourceMapFilename: '[name].js.map',
2020-04-26 20:33:39 +00:00
library: 'insomniaComponents',
libraryTarget: 'commonjs2',
},
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: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: [/node_modules/],
options: {
configFile: 'tsconfig.build.json',
getCustomTransformers: () => ({ before: [styledComponentsTransformer] }),
2020-04-26 20:33:39 +00:00
},
},
],
},
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
},
externals: ['react', 'react-dom', 'styled-components'],
2020-04-26 20:33:39 +00:00
};