Skip to content

Commit

Permalink
Merge pull request #24 from alisaitteke/develop
Browse files Browse the repository at this point in the history
🔧 chore(package.json): update build script in package.json to include…
  • Loading branch information
alisaitteke authored Dec 24, 2023
2 parents e1196d7 + 82735ad commit 3638325
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"sideEffects": false,
"scripts": {
"start": "rollup --config --watch --bundleConfigAsCjs",
"build": "rollup -c --bundleConfigAsCjs"
"build": "rollup -c --prod --bundleConfigAsCjs"
},
"engines": {
"node": ">=18.0.0"
Expand Down
82 changes: 45 additions & 37 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,50 @@ import peerDepsExternal from "rollup-plugin-peer-deps-external";
import serve from 'rollup-plugin-serve'
import scss from 'rollup-plugin-scss'
import livereload from 'rollup-plugin-livereload'

const packageJson = require("./package.json");

export default [
{
input: "src/lib/canvas.index.ts",
output: [
{
file: packageJson.main,
format: "iife",
sourcemap: true,
},
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
plugins: [
scss(),
peerDepsExternal(),
resolve(),
commonjs(),
typescript({tsconfig: "./tsconfig.json"}),
terser(),
livereload(),
serve({
openPage: '/index.html',
contentBase: ['dist', 'examples','src'],
port: 3002,
})
],
external: [],
},
{
input: "src/lib/canvas.index.ts",
output: [{file: "dist/types.d.ts", format: "es"}],
plugins: [scss(), dts.default()],
},
];
export default commandLineArgs => {
console.log('cmd', commandLineArgs)
let config = [
{
input: "src/lib/canvas.index.ts",
output: [
{
file: packageJson.main,
format: "iife",
sourcemap: true,
},
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
plugins: [
scss(),
peerDepsExternal(),
resolve(),
commonjs(),
typescript({tsconfig: "./tsconfig.json"}),
terser()
],
external: [],
},
{
input: "src/lib/canvas.index.ts",
output: [{file: "dist/types.d.ts", format: "es"}],
plugins: [scss(), dts.default()],
},
];
console.log('commandLineArgs.prod', commandLineArgs.prod)
if (!commandLineArgs.prod) {
config[0].plugins.push(livereload())
config[0].plugins.push(serve({
openPage: '/index.html',
contentBase: ['dist', 'examples', 'src'],
port: 3002,
}))
}
return config;
}

0 comments on commit 3638325

Please # to comment.