Last active
February 15, 2021 10:21
-
-
Save thiporia/49eb6672ad209ab1a2e05af49dab6a1d to your computer and use it in GitHub Desktop.
basic rollup.config.js with sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { babel } from '@rollup/plugin-babel' | |
import alias from '@rollup/plugin-alias' | |
import nodeResolve from '@rollup/plugin-node-resolve' | |
import commonjs from '@rollup/plugin-commonjs' | |
import postcss from 'rollup-plugin-postcss' | |
import json from '@rollup/plugin-json' | |
import url from '@rollup/plugin-url' | |
import typescript from '@rollup/plugin-typescript' | |
import pkg from './package.json' | |
export default { | |
input: 'src/index.ts', | |
output: [ | |
{ | |
file: pkg.main, | |
format: 'cjs', | |
sourcemap: true, | |
}, | |
{ | |
file: pkg.module, | |
format: 'esm', | |
sourcemap: true, | |
}, | |
], | |
plugins: [ | |
babel({ | |
babelHelpers: 'bundled', | |
exclude: 'node_modules/**', | |
extensions: ['.js', '.ts', '.tsx'], | |
}), | |
alias({ | |
entries: [ | |
{ find: '@src', replacement: 'src' }, | |
{ find: '@Styles', replacement: 'src/assets/styles' }, | |
{ find: '@Components', replacement: 'src/components' }, | |
], | |
}), | |
postcss({ | |
includePaths: ['src/components', 'src/assets/styles'], | |
extensions: ['.css', '.scss', '.sass'], | |
}), | |
nodeResolve({ | |
mainFields: ['browser', 'jsnext', 'module', 'main'], | |
}), | |
commonjs({ extensions: ['.js', '.ts', '.tsx'] }), | |
url(), | |
json(), | |
typescript(), | |
], | |
external: [ | |
'react', | |
'react-dom', | |
'styled-components', | |
'typescript', | |
'tslib', | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment