Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
fix(vue-cli): Remove unnecessary configuration for vue-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Lenzotti committed Sep 11, 2018
1 parent d910ede commit fdc9f64
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 60 deletions.
4 changes: 2 additions & 2 deletions packages/cli-plugin-fractal/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = config => {
docsDir: '<rootDir>/fractal/docs',
helpersDir: '<rootDir>/fractal/helpers',
middlewaresDir: '<rootDir>/fractal/middlewares',
proxyPatterns: ['/Fonts/**', '/Images/**', '/Icons/**'],
proxyPatterns: ['/fonts/**', '/images/**', '/icons/**', '/medias/**', '/public/**'],
...(config.get('fractal') || {})
})
);
Expand All @@ -31,7 +31,7 @@ module.exports = config => {

vendors.push(`/vendors.${name}.js`);
bundles.push(`/${name}.js`);
styles.push(`/${name}.css`);
styles.push(`css/${name}.css`);

cleanGlob.push(`${name}.**`);
});
Expand Down
51 changes: 0 additions & 51 deletions packages/cli-plugin-vue/src/webpack/assets.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
const getAssetPath = require('@vue/cli-service/lib/util/getAssetPath');

module.exports = function buildWebpackAssets(config, webpackConfig, vueConfig) {
const inlineLimit = 10000;

webpackConfig
.mode('production')
.devtool('source-map')
.output.filename(getAssetPath(vueConfig, '[name].js'))
.chunkFilename(getAssetPath(vueConfig, '[name].js'));

webpackConfig.module
.rule('images')
.test(/\.(png|jpe?g|gif)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
limit: inlineLimit,
name: 'Images/[name].[hash:8].[ext]'
});

webpackConfig.module
.rule('svg')
.test(/\.(svg)(\?.*)?$/)
.use('file-loader')
.loader('file-loader')
.options({
name: 'Icons/[name].[hash:8].[ext]'
});

webpackConfig.module
.rule('media')
.test(/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
limit: inlineLimit,
name: 'Medias/[name].[hash:8].[ext]'
});

webpackConfig.module
.rule('fonts')
.test(/\.(woff2?|eot|ttf|otf)(\?.*)?$/i)
.use('url-loader')
.loader('url-loader')
.options({
limit: inlineLimit,
name: 'Fonts/[name].[hash:8].[ext]'
});

if (webpackConfig.plugins.has('extract-css')) {
webpackConfig.plugin('extract-css').tap(args =>
args.map(item => ({
...item,
filename: getAssetPath(webpackConfig, '[name].css'),
chunkFilename: getAssetPath(webpackConfig, '[name].css')
}))
);
}
};
14 changes: 7 additions & 7 deletions packages/cli-plugin-vue/src/webpack/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ module.exports = (config, baseVueConfig) => {
},

chainWebpack(webpackConfig) {
const isProd = process.env.NODE_ENV === 'production';
// const isProd = process.env.NODE_ENV === 'production';
// Reset configuration
resetWebpackConfig(webpackConfig);

if (isProd) {
webpackConfig
.devtool('source-map')
.output.filename('[name].js')
.chunkFilename('[id].js');
}
// if (isProd) {
// webpackConfig
// .devtool('source-map')
// .output.filename('[name].js')
// .chunkFilename('[id].js');
// }

buildWebpackAlias(config, webpackConfig);
buildWebpackEntries(config, webpackConfig, vueConfig);
Expand Down

0 comments on commit fdc9f64

Please sign in to comment.