-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(create-app): native esm templates (#2609)
- Loading branch information
Showing
16 changed files
with
81 additions
and
61 deletions.
There are no files selected for viewing
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
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
43 changes: 0 additions & 43 deletions
43
packages/create-stylable-app/template/ts-react-rollup/rollup.config.cjs
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
packages/create-stylable-app/template/ts-react-rollup/rollup.config.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @ts-check | ||
|
||
import { stylableRollupPlugin } from '@stylable/rollup-plugin'; | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import html from '@rollup/plugin-html'; | ||
import image from '@rollup/plugin-image'; | ||
import replace from '@rollup/plugin-replace'; | ||
import rollupTypescript from '@rollup/plugin-typescript'; | ||
import copy from 'rollup-plugin-copy'; | ||
import serve from 'rollup-plugin-serve'; | ||
|
||
const isProductionMode = process.env.NODE_ENV === 'production'; | ||
|
||
/** @type {import('rollup').RollupOptions} */ | ||
export default { | ||
input: 'src/index.tsx', | ||
output: { | ||
file: 'dist/bundle.js', | ||
format: 'umd', | ||
sourcemap: !isProductionMode, | ||
}, | ||
plugins: [ | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'), | ||
preventAssignment: true, | ||
}), | ||
image(), | ||
nodeResolve(), | ||
commonjs(), | ||
html({}), | ||
rollupTypescript({ compilerOptions: { sourceMap: !isProductionMode } }), | ||
stylableRollupPlugin({ stcConfig: true, optimization: { minify: isProductionMode } }), | ||
copy({ | ||
targets: [{ src: 'favicon.ico', dest: 'dist' }], | ||
}), | ||
!isProductionMode && | ||
serve({ | ||
open: true, | ||
contentBase: ['dist'], | ||
port: 3000, | ||
}), | ||
], | ||
}; |
4 changes: 2 additions & 2 deletions
4
...mplate/ts-react-rollup/stylable.config.js → ...plate/ts-react-rollup/stylable.config.cjs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
//@ts-check | ||
// @ts-check | ||
|
||
const { typedConfiguration } = require('@stylable/cli'); | ||
|
||
exports.stcConfig = typedConfiguration({ | ||
options: { | ||
srcDir: './src', | ||
outDir: './st-types', | ||
dts: true, | ||
cjs: false, | ||
}, | ||
}); |
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
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
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
4 changes: 2 additions & 2 deletions
4
.../ts-react-webpack-lean/stylable.config.js → ...ts-react-webpack-lean/stylable.config.cjs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
//@ts-check | ||
// @ts-check | ||
|
||
const { typedConfiguration } = require('@stylable/cli'); | ||
|
||
exports.stcConfig = typedConfiguration({ | ||
options: { | ||
srcDir: './src', | ||
outDir: './st-types', | ||
dts: true, | ||
cjs: false, | ||
}, | ||
}); |
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
8 changes: 5 additions & 3 deletions
8
packages/create-stylable-app/template/ts-react-webpack-lean/webpack.config.js
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
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
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
4 changes: 2 additions & 2 deletions
4
...plate/ts-react-webpack/stylable.config.js → ...late/ts-react-webpack/stylable.config.cjs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
//@ts-check | ||
// @ts-check | ||
|
||
const { typedConfiguration } = require('@stylable/cli'); | ||
|
||
exports.stcConfig = typedConfiguration({ | ||
options: { | ||
srcDir: './src', | ||
outDir: './st-types', | ||
dts: true, | ||
cjs: false, | ||
}, | ||
}); |
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
8 changes: 5 additions & 3 deletions
8
packages/create-stylable-app/template/ts-react-webpack/webpack.config.js
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