Skip to content

Commit

Permalink
fix context warning angular + css minifier on prod + postcss warning fix
Browse files Browse the repository at this point in the history
  • Loading branch information
w-raken committed Nov 9, 2017
1 parent 893ee46 commit 0f19067
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ npm install
## <a name="skeleton"></a>Skeleton
```
electron-angular-webpack/
├──app/ * angular app folder
├──app/ # angular app folder
├──builder/ * packagers and installers config folder
│ ├──icons/ * multi os app icons
│ │ ├──linux/ * app icon folder for linux
├──builder/ # packagers and installers config folder
│ ├──icons/ # multi os app icons
│ │ ├──linux/ # app icon folder for linux
│ │ │ └──icon.png ~ must be a png
│ │ ├──mac/ * app icon folder for mac
│ │ ├──mac/ # app icon folder for mac
│ │ │ └──icon.icns ~ must be a icns
│ │ └──windows/ * app icon folder for windows
│ │ └──windows/ # app icon folder for windows
│ │ └──icon.ico ~ must be a ico
│ │
│ ├──installer.js ~ config file for installers
Expand All @@ -95,27 +95,27 @@ electron-angular-webpack/
├──LICENSE.md ~ license of this project
├──README.md ~ contains information about this project
├──electron.ts ~ entry file for Electron
├──package-lock.json ~ describes the exact tree that was generated by node/npm (vers. > 8)
├──package.json ~ manifest about applications, modules, packages, and more
├──postcss.config.js ~ postcss loader configuration file
├──tsconfig.json ~ specifies root files and compiler options required to compile
└──webpack.config.js ~ webpack main configuration file
```
**In addition to this structure, our commands will create these elements :**
```
.
├──package-lock.json ~ describes the exact tree that was generated by node/npm (vers. > 8)
├──dist/ * compiled code/library
├──dist/ # compiled code/library
├──node_modules/ * non-global libraries are installed here
├──node_modules/ # non-global libraries are installed here
├──mac_packager/ * packager folder for mac (removed after npm run installer:mac)
├──mac_installer/ * installer folder for mac
├──mac_packager/ # packager folder for mac (removed after npm run installer:mac)
├──mac_installer/ # installer folder for mac
├──linux_packager/ * packager folder for linux (removed after npm run installer:linux)
├──linux_installer/ * installer folder for linux
├──linux_packager/ # packager folder for linux (removed after npm run installer:linux)
├──linux_installer/ # installer folder for linux
├──win_packager/ * packager folder for windows (removed after npm run installer:win)
└──win_installer/ * installer folder for windows
├──win_packager/ # packager folder for windows (removed after npm run installer:win)
└──win_installer/ # installer folder for windows
```

## Contributors
Expand Down
34 changes: 26 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const dev = process.env.NODE_ENV === "dev";
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const exec = require('child_process').exec;
const uglifyJs = require('uglifyjs-webpack-plugin');
Expand Down Expand Up @@ -55,11 +56,27 @@ let webpackConfig = {
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: 'file-loader',
options: {
name: 'css/[name].[hash:10].css'
}
}, 'extract-loader', 'css-loader', 'postcss-loader', 'resolve-url-loader', 'sass-loader'],
loader: 'file-loader',
options: {
name: 'css/[name].[hash:10].css'
}
},
'extract-loader',
{
loader: 'css-loader',
options: {
minimize: dev ? false : true
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: dev ? true : false
}
},
'resolve-url-loader',
'sass-loader'
],
}, {
// All files with a '.html' extension will be handled by html-loader and save into external file
test: /\.html$/,
Expand Down Expand Up @@ -92,10 +109,10 @@ let webpackConfig = {
exclude: /node_modules/,
use: {
loader: 'html-loader',
options: {
options: {
attrs: ['img:src', 'link:href']
}
}
}
}]
},
// Configure how modules are resolved
Expand All @@ -119,7 +136,8 @@ let webpackConfig = {
},
// Customize the webpack build process with additionals plugins
plugins: [
new htmlWebpackPlugin(indexConfig)
new htmlWebpackPlugin(indexConfig),
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)/, path.resolve(__dirname, './src')),
],
};

Expand Down

0 comments on commit 0f19067

Please sign in to comment.