Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup for JS, Babel, Typescript and React with code formatting apis #69

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/templates/rollup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,26 @@ export const getRollupConfig = features => {
`import commonjs from 'rollup-plugin-commonjs';`,
];
const output = [];
const plugins = ['resolve()'];
const plugins = [];
if (isBabel) {
imports.push(`import babel from "rollup-plugin-babel";`);
plugins.push(`babel({
exclude: "node_modules/**"
})`);
}
const resolveExtensions = ['.json'];
if (isReact) {
if (isTypescript) resolveExtensions.push('.ts', '.tsx');
else resolveExtensions.push('.js', '.jsx');
} else if (isTypescript) {
resolveExtensions.push('.ts');
} else {
resolveExtensions.push('.js');
}
plugins.push(`resolve({
extensions:${JSON.stringify(resolveExtensions)}
}`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a missing ) for resolve


if (isReact) {
imports.push(
`import globals from 'rollup-plugin-node-globals';`,
Expand Down Expand Up @@ -131,12 +150,6 @@ export const getRollupConfig = features => {
} else {
plugins.push('commonjs()');
}
if (isBabel) {
imports.push(`import babel from "rollup-plugin-babel";`);
plugins.push(`babel({
exclude: "node_modules/**"
})`);
}

if (isTypescript) {
imports.push(`import typescript from 'rollup-plugin-typescript2';`);
Expand Down