Skip to content

Commit c172724

Browse files
author
Maciej Warszawski
committed
fix rollup typescript configuration
1 parent dbc3ae0 commit c172724

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed

rollup.lib.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import path from 'path';
2-
// import babel from 'rollup-plugin-babel';
3-
import typescript from 'rollup-plugin-typescript';
4-
import postcss from 'rollup-plugin-postcss';
5-
const ts = require('typescript');
6-
//const postcss = require('postcss');
7-
const modules = require('postcss-modules');
2+
import pluginTypescript from 'rollup-plugin-typescript';
3+
import pluginPostcss from 'rollup-plugin-postcss';
4+
import postCssCssNext from 'postcss-cssnext';
5+
import typescript from 'typescript';
6+
import tsconfig from './tsconfig.lib.json';
87

98
const copyright = `/*
109
* Copyright ${new Date().getFullYear()}, warszawski.pro
@@ -17,15 +16,16 @@ const cssExportMap = {};
1716
function rollupConfig(packageBasePath) {
1817
const pkg = require(path.resolve(packageBasePath, 'package.json'));
1918
const plugins = [
20-
typescript({
21-
typescript: ts,
22-
tsconfig: 'tsconfig.types.json',
19+
pluginTypescript({
20+
typescript,
21+
tsconfig: false,
22+
...tsconfig.compilerOptions,
2323
}),
24-
postcss({
24+
pluginPostcss({
2525
modules: true,
2626
extensions: ['.css'],
2727
namedExports: true,
28-
plugins: [require('postcss-cssnext')],
28+
plugins: [postCssCssNext],
2929
}),
3030
];
3131
const external = Object.getOwnPropertyNames(pkg.peerDependencies);

tsconfig.lib.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"module": "es2015",
4+
"target": "es5",
5+
"stripInternal": true,
6+
"importHelpers": true,
7+
"moduleResolution": "node",
8+
"strict": true,
9+
"noImplicitAny": true,
10+
"jsx": "react",
11+
"types": [
12+
"react-dom",
13+
"react",
14+
"react-intl",
15+
"node",
16+
"classnames",
17+
"invariant"
18+
],
19+
"esModuleInterop": true
20+
}
21+
}

webpack.common.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const webpack = require('webpack');
55

66
module.exports = {
77
plugins: [
8-
new CleanWebpackPlugin(['dist']),
98
new webpack.NamedModulesPlugin(),
109
new HtmlWebpackPlugin({
1110
title: 'Hot Module Replacement',

webpack.dev.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ module.exports = merge(common, {
77
entry: {
88
bundle: ['./integration/index.tsx'],
99
},
10-
//devtool: 'source-map',
11-
devServer: {
12-
contentBase: './dist',
13-
},
1410
resolve: {
1511
modules: ['node_modules'],
16-
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.css'],
12+
extensions: ['.ts', '.tsx', '.js', '.css'],
1713
},
1814
module: {
1915
rules: [
@@ -31,6 +27,7 @@ module.exports = merge(common, {
3127
{
3228
test: /\.ts(x?)$/,
3329
use: ['awesome-typescript-loader'],
30+
exclude: [/\.test\.ts(x?)$/, /dist\/.*\.d\.ts$/],
3431
},
3532
{
3633
test: /\.(css)$/,

0 commit comments

Comments
 (0)