Skip to content

Commit

Permalink
chore: fix WebPack build for github website demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Sep 23, 2023
1 parent 2714f77 commit e8a625b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ jobs:
run: yarn build:demo

- name: Start HTTP Server
# run: yarn serve:demo &
run: yarn start &
run: yarn serve:demo &

- name: Run Cypress E2E tests
uses: cypress-io/[email protected]
Expand All @@ -74,7 +73,7 @@ jobs:
config-file: cypress.config.ts
wait-on: "http://localhost:9000"
browser: chrome
# record: true
record: true
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
],
"dependencies": {
"@aurelia/i18n": "latest",
"@aurelia/router": "latest",
"@slickgrid-universal/common": "^3.2.1",
"@slickgrid-universal/custom-footer-component": "^3.2.1",
"@slickgrid-universal/empty-warning-component": "^3.2.1",
Expand All @@ -41,6 +40,7 @@
},
"devDependencies": {
"@aurelia/fetch-client": "latest",
"@aurelia/router": "latest",
"@aurelia/testing": "latest",
"@aurelia/ts-jest": "latest",
"@aurelia/webpack-loader": "latest",
Expand Down Expand Up @@ -99,6 +99,7 @@
},
"scripts": {
"build:demo": "webpack --env production",
"build:plugin": "webpack --env node",
"serve:demo": "servor ./docs index.html 9000",
"delete:dist": "rimraf dist",
"lint": "eslint src/aurelia-slickgrid --ext .ts",
Expand Down
19 changes: 8 additions & 11 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ const postcssLoader = {
}
};

module.exports = ({ production } = {}, { server } = {}, { analyze } = {}) => {
module.exports = ({ production, node } = {}, { server } = {}, { analyze } = {}) => {
// console.log('webpack', analyze, production, server, node);
// const production = server.production || false;
// const production = env.production || process.env.NODE_ENV === 'production';
return {
target: production ? 'node' : 'web',
target: node ? 'node' : 'web',
mode: production ? 'production' : 'development',
devtool: production ? 'source-map' : 'inline-source-map',
// devtool: production ? 'source-map' : 'inline-source-map',
devtool: production ? false : 'eval-cheap-module-source-map',
entry: {
// Build only plugin in production mode,
// build dev-app in non-production mode
entry: production ? './src/aurelia-slickgrid/index.ts' : './src/main.ts'
entry: node ? './src/aurelia-slickgrid/index.ts' : './src/main.ts'
},
output: {
path: production ? outProdDir : outDevDir,
Expand Down Expand Up @@ -101,21 +103,16 @@ module.exports = ({ production } = {}, { server } = {}, { analyze } = {}) => {
}
]
},
externalsPresets: { node: production },
externalsPresets: node && { node: production },
externals: [
// Skip npm dependencies in plugin build.
production && nodeExternals()
node && nodeExternals()
].filter(p => p),
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
favicon: `${srcDir}/favicon.ico`,
metadata: {
// available in index.ejs //
title, server, baseUrl
}
}),
// !production && new HtmlWebpackPlugin({ template: 'index.html', favicon: 'favicon.ico' }),
new Dotenv({
path: `./.env${production ? '' : '.' + (process.env.NODE_ENV || 'development')}`,
}),
Expand Down

0 comments on commit e8a625b

Please sign in to comment.