why webpack4 production bundle will always include style-loader, css-loader and vue-loader content?
The exported multiple entry compiled js files in my multi entry point final bundle built with production mode in webpack always include loaders content. How to eliminate them and why they are included?
To reproduce
git clone https://github.com/adamchenwei/boilerplate-webpack-babel-sass-storybook-vuejs.git
git checkout step/3-prod-webpack-build-setup-basic
npm install
npm run build:prod
Any idea will be appreciated.
https://webpack.js.org/plugins/module-concatenation-plugin/ did not help either.
I read couple SO also seems no solution for it yet.
Thanks
webpack.common.js
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
app: './src/library.js',
HelloComp: './src/components/HelloComponent/HelloComponent.vue',
Bye: './src/components/ByeComponent/ByeComponent.vue'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Production'
})
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
externals: {
'vue': {
root: 'vue',
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue',
umd: 'vue'
},
'vue-router': {
root: 'vue-router',
commonjs2: 'vue-router',
commonjs: 'vue-router',
amd: 'vue-router',
umd: 'vue-router'
},
'style-loader': {
root: 'style-loader',
commonjs2: 'style-loader',
commonjs: 'style-loader',
amd: 'style-loader',
umd: 'style-loader'
},
'vue-hot-reload-api': {
root: 'vue-hot-reload-api',
commonjs2: 'vue-hot-reload-api',
commonjs: 'vue-hot-reload-api',
amd: 'vue-hot-reload-api',
umd: 'vue-hot-reload-api'
},
'vue-loader': {
root: 'vue-loader',
commonjs2: 'vue-loader',
commonjs: 'vue-loader',
amd: 'vue-loader',
umd: 'vue-loader'
}
}
}
webpack.prod.js
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const path = require('path')
// function resolve (dir) {
// return path.join(__dirname, '..', dir)
// }
const configedAnalyzer = new BundleAnalyzerPlugin({
// Can be `server`, `static` or `disabled`.
// In `server` mode analyzer will start HTTP server to show bundle report.
// In `static` mode single HTML file with bundle report will be generated.
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
analyzerMode: 'static',
// Host that will be used in `server` mode to start HTTP server.
analyzerHost: '127.0.0.1',
// Port that will be used in `server` mode to start HTTP server.
analyzerPort: 8887,
// Path to bundle report file that will be generated in `static` mode.
// Relative to bundles output directory.
reportFilename: './../report/bundle_anlaysis.html',
// Module sizes to show in report by default.
// Should be one of `stat`, `parsed` or `gzip`.
// See "Definitions" section for more information.
defaultSizes: 'gzip',
// Automatically open report in default browser
openAnalyzer: true,
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
generateStatsFile: true,
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
// Relative to bundles output directory.
statsFilename: 'stats.json',
// Options for `stats.toJson()` method.
// For example you can exclude sources of your modules
// from stats file with `source: false` option.
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
statsOptions: null,
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
logLevel: 'info'
})
module.exports = merge(common, {
mode: 'production',
module: {
rules: [
{
test: /.vue$/,
use: 'vue-loader'
},
// IMPORTANT: All js load should come AFTER vue-loader!!!
{
test: /.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre' // kick in before other loader... Q: also before vue-loader I suppose? maybe better move it to top?
},
{
test: /.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /.js$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new CopyWebpackPlugin([{
// NOTE: it does not really do anything, unless we have a asset folder, that needed no compression
from: './static/',
to: './static/',
toType: 'dir'
}]),
// NOTE: honestly, this did not help reduce prod bundle size... but for wtw:
// https://webpack.js.org/plugins/module-concatenation-plugin/
new webpack.optimize.ModuleConcatenationPlugin(),
// NOTE: disable when needed, its just to analyze code
configedAnalyzer
],
stats: {
// Examine all modules
maxModules: Infinity,
// Display bailout reasons
optimizationBailout: true
}
});
javascript vue.js webpack webpack-4 webpack-style-loader
add a comment |
The exported multiple entry compiled js files in my multi entry point final bundle built with production mode in webpack always include loaders content. How to eliminate them and why they are included?
To reproduce
git clone https://github.com/adamchenwei/boilerplate-webpack-babel-sass-storybook-vuejs.git
git checkout step/3-prod-webpack-build-setup-basic
npm install
npm run build:prod
Any idea will be appreciated.
https://webpack.js.org/plugins/module-concatenation-plugin/ did not help either.
I read couple SO also seems no solution for it yet.
Thanks
webpack.common.js
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
app: './src/library.js',
HelloComp: './src/components/HelloComponent/HelloComponent.vue',
Bye: './src/components/ByeComponent/ByeComponent.vue'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Production'
})
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
externals: {
'vue': {
root: 'vue',
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue',
umd: 'vue'
},
'vue-router': {
root: 'vue-router',
commonjs2: 'vue-router',
commonjs: 'vue-router',
amd: 'vue-router',
umd: 'vue-router'
},
'style-loader': {
root: 'style-loader',
commonjs2: 'style-loader',
commonjs: 'style-loader',
amd: 'style-loader',
umd: 'style-loader'
},
'vue-hot-reload-api': {
root: 'vue-hot-reload-api',
commonjs2: 'vue-hot-reload-api',
commonjs: 'vue-hot-reload-api',
amd: 'vue-hot-reload-api',
umd: 'vue-hot-reload-api'
},
'vue-loader': {
root: 'vue-loader',
commonjs2: 'vue-loader',
commonjs: 'vue-loader',
amd: 'vue-loader',
umd: 'vue-loader'
}
}
}
webpack.prod.js
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const path = require('path')
// function resolve (dir) {
// return path.join(__dirname, '..', dir)
// }
const configedAnalyzer = new BundleAnalyzerPlugin({
// Can be `server`, `static` or `disabled`.
// In `server` mode analyzer will start HTTP server to show bundle report.
// In `static` mode single HTML file with bundle report will be generated.
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
analyzerMode: 'static',
// Host that will be used in `server` mode to start HTTP server.
analyzerHost: '127.0.0.1',
// Port that will be used in `server` mode to start HTTP server.
analyzerPort: 8887,
// Path to bundle report file that will be generated in `static` mode.
// Relative to bundles output directory.
reportFilename: './../report/bundle_anlaysis.html',
// Module sizes to show in report by default.
// Should be one of `stat`, `parsed` or `gzip`.
// See "Definitions" section for more information.
defaultSizes: 'gzip',
// Automatically open report in default browser
openAnalyzer: true,
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
generateStatsFile: true,
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
// Relative to bundles output directory.
statsFilename: 'stats.json',
// Options for `stats.toJson()` method.
// For example you can exclude sources of your modules
// from stats file with `source: false` option.
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
statsOptions: null,
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
logLevel: 'info'
})
module.exports = merge(common, {
mode: 'production',
module: {
rules: [
{
test: /.vue$/,
use: 'vue-loader'
},
// IMPORTANT: All js load should come AFTER vue-loader!!!
{
test: /.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre' // kick in before other loader... Q: also before vue-loader I suppose? maybe better move it to top?
},
{
test: /.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /.js$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new CopyWebpackPlugin([{
// NOTE: it does not really do anything, unless we have a asset folder, that needed no compression
from: './static/',
to: './static/',
toType: 'dir'
}]),
// NOTE: honestly, this did not help reduce prod bundle size... but for wtw:
// https://webpack.js.org/plugins/module-concatenation-plugin/
new webpack.optimize.ModuleConcatenationPlugin(),
// NOTE: disable when needed, its just to analyze code
configedAnalyzer
],
stats: {
// Examine all modules
maxModules: Infinity,
// Display bailout reasons
optimizationBailout: true
}
});
javascript vue.js webpack webpack-4 webpack-style-loader
post your config.
– PlayMa256
Nov 13 '18 at 10:43
1
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40
add a comment |
The exported multiple entry compiled js files in my multi entry point final bundle built with production mode in webpack always include loaders content. How to eliminate them and why they are included?
To reproduce
git clone https://github.com/adamchenwei/boilerplate-webpack-babel-sass-storybook-vuejs.git
git checkout step/3-prod-webpack-build-setup-basic
npm install
npm run build:prod
Any idea will be appreciated.
https://webpack.js.org/plugins/module-concatenation-plugin/ did not help either.
I read couple SO also seems no solution for it yet.
Thanks
webpack.common.js
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
app: './src/library.js',
HelloComp: './src/components/HelloComponent/HelloComponent.vue',
Bye: './src/components/ByeComponent/ByeComponent.vue'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Production'
})
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
externals: {
'vue': {
root: 'vue',
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue',
umd: 'vue'
},
'vue-router': {
root: 'vue-router',
commonjs2: 'vue-router',
commonjs: 'vue-router',
amd: 'vue-router',
umd: 'vue-router'
},
'style-loader': {
root: 'style-loader',
commonjs2: 'style-loader',
commonjs: 'style-loader',
amd: 'style-loader',
umd: 'style-loader'
},
'vue-hot-reload-api': {
root: 'vue-hot-reload-api',
commonjs2: 'vue-hot-reload-api',
commonjs: 'vue-hot-reload-api',
amd: 'vue-hot-reload-api',
umd: 'vue-hot-reload-api'
},
'vue-loader': {
root: 'vue-loader',
commonjs2: 'vue-loader',
commonjs: 'vue-loader',
amd: 'vue-loader',
umd: 'vue-loader'
}
}
}
webpack.prod.js
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const path = require('path')
// function resolve (dir) {
// return path.join(__dirname, '..', dir)
// }
const configedAnalyzer = new BundleAnalyzerPlugin({
// Can be `server`, `static` or `disabled`.
// In `server` mode analyzer will start HTTP server to show bundle report.
// In `static` mode single HTML file with bundle report will be generated.
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
analyzerMode: 'static',
// Host that will be used in `server` mode to start HTTP server.
analyzerHost: '127.0.0.1',
// Port that will be used in `server` mode to start HTTP server.
analyzerPort: 8887,
// Path to bundle report file that will be generated in `static` mode.
// Relative to bundles output directory.
reportFilename: './../report/bundle_anlaysis.html',
// Module sizes to show in report by default.
// Should be one of `stat`, `parsed` or `gzip`.
// See "Definitions" section for more information.
defaultSizes: 'gzip',
// Automatically open report in default browser
openAnalyzer: true,
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
generateStatsFile: true,
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
// Relative to bundles output directory.
statsFilename: 'stats.json',
// Options for `stats.toJson()` method.
// For example you can exclude sources of your modules
// from stats file with `source: false` option.
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
statsOptions: null,
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
logLevel: 'info'
})
module.exports = merge(common, {
mode: 'production',
module: {
rules: [
{
test: /.vue$/,
use: 'vue-loader'
},
// IMPORTANT: All js load should come AFTER vue-loader!!!
{
test: /.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre' // kick in before other loader... Q: also before vue-loader I suppose? maybe better move it to top?
},
{
test: /.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /.js$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new CopyWebpackPlugin([{
// NOTE: it does not really do anything, unless we have a asset folder, that needed no compression
from: './static/',
to: './static/',
toType: 'dir'
}]),
// NOTE: honestly, this did not help reduce prod bundle size... but for wtw:
// https://webpack.js.org/plugins/module-concatenation-plugin/
new webpack.optimize.ModuleConcatenationPlugin(),
// NOTE: disable when needed, its just to analyze code
configedAnalyzer
],
stats: {
// Examine all modules
maxModules: Infinity,
// Display bailout reasons
optimizationBailout: true
}
});
javascript vue.js webpack webpack-4 webpack-style-loader
The exported multiple entry compiled js files in my multi entry point final bundle built with production mode in webpack always include loaders content. How to eliminate them and why they are included?
To reproduce
git clone https://github.com/adamchenwei/boilerplate-webpack-babel-sass-storybook-vuejs.git
git checkout step/3-prod-webpack-build-setup-basic
npm install
npm run build:prod
Any idea will be appreciated.
https://webpack.js.org/plugins/module-concatenation-plugin/ did not help either.
I read couple SO also seems no solution for it yet.
Thanks
webpack.common.js
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
app: './src/library.js',
HelloComp: './src/components/HelloComponent/HelloComponent.vue',
Bye: './src/components/ByeComponent/ByeComponent.vue'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
title: 'Production'
})
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
externals: {
'vue': {
root: 'vue',
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue',
umd: 'vue'
},
'vue-router': {
root: 'vue-router',
commonjs2: 'vue-router',
commonjs: 'vue-router',
amd: 'vue-router',
umd: 'vue-router'
},
'style-loader': {
root: 'style-loader',
commonjs2: 'style-loader',
commonjs: 'style-loader',
amd: 'style-loader',
umd: 'style-loader'
},
'vue-hot-reload-api': {
root: 'vue-hot-reload-api',
commonjs2: 'vue-hot-reload-api',
commonjs: 'vue-hot-reload-api',
amd: 'vue-hot-reload-api',
umd: 'vue-hot-reload-api'
},
'vue-loader': {
root: 'vue-loader',
commonjs2: 'vue-loader',
commonjs: 'vue-loader',
amd: 'vue-loader',
umd: 'vue-loader'
}
}
}
webpack.prod.js
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const path = require('path')
// function resolve (dir) {
// return path.join(__dirname, '..', dir)
// }
const configedAnalyzer = new BundleAnalyzerPlugin({
// Can be `server`, `static` or `disabled`.
// In `server` mode analyzer will start HTTP server to show bundle report.
// In `static` mode single HTML file with bundle report will be generated.
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
analyzerMode: 'static',
// Host that will be used in `server` mode to start HTTP server.
analyzerHost: '127.0.0.1',
// Port that will be used in `server` mode to start HTTP server.
analyzerPort: 8887,
// Path to bundle report file that will be generated in `static` mode.
// Relative to bundles output directory.
reportFilename: './../report/bundle_anlaysis.html',
// Module sizes to show in report by default.
// Should be one of `stat`, `parsed` or `gzip`.
// See "Definitions" section for more information.
defaultSizes: 'gzip',
// Automatically open report in default browser
openAnalyzer: true,
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
generateStatsFile: true,
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
// Relative to bundles output directory.
statsFilename: 'stats.json',
// Options for `stats.toJson()` method.
// For example you can exclude sources of your modules
// from stats file with `source: false` option.
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
statsOptions: null,
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
logLevel: 'info'
})
module.exports = merge(common, {
mode: 'production',
module: {
rules: [
{
test: /.vue$/,
use: 'vue-loader'
},
// IMPORTANT: All js load should come AFTER vue-loader!!!
{
test: /.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre' // kick in before other loader... Q: also before vue-loader I suppose? maybe better move it to top?
},
{
test: /.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /.js$/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new CopyWebpackPlugin([{
// NOTE: it does not really do anything, unless we have a asset folder, that needed no compression
from: './static/',
to: './static/',
toType: 'dir'
}]),
// NOTE: honestly, this did not help reduce prod bundle size... but for wtw:
// https://webpack.js.org/plugins/module-concatenation-plugin/
new webpack.optimize.ModuleConcatenationPlugin(),
// NOTE: disable when needed, its just to analyze code
configedAnalyzer
],
stats: {
// Examine all modules
maxModules: Infinity,
// Display bailout reasons
optimizationBailout: true
}
});
javascript vue.js webpack webpack-4 webpack-style-loader
javascript vue.js webpack webpack-4 webpack-style-loader
edited Nov 13 '18 at 14:40
Ezeewei
asked Nov 12 '18 at 21:53
EzeeweiEzeewei
2,33732660
2,33732660
post your config.
– PlayMa256
Nov 13 '18 at 10:43
1
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40
add a comment |
post your config.
– PlayMa256
Nov 13 '18 at 10:43
1
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40
post your config.
– PlayMa256
Nov 13 '18 at 10:43
post your config.
– PlayMa256
Nov 13 '18 at 10:43
1
1
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40
add a comment |
1 Answer
1
active
oldest
votes
Remove style-loader
from your externals and make sure to generate actual css files from your css... otherwise webpack has to insert your styles somehow, right?
To do that use mini-css-extract-plugin
.
{
test: /.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
}
don't forget to add new MiniCssExtractPlugin()
to your plugins too. Preferable only for production build.
it seems build successfully, but when I try to import into another vue ap, it is geting error of[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?
– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270649%2fwhy-webpack4-production-bundle-will-always-include-style-loader-css-loader-and%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Remove style-loader
from your externals and make sure to generate actual css files from your css... otherwise webpack has to insert your styles somehow, right?
To do that use mini-css-extract-plugin
.
{
test: /.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
}
don't forget to add new MiniCssExtractPlugin()
to your plugins too. Preferable only for production build.
it seems build successfully, but when I try to import into another vue ap, it is geting error of[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?
– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
add a comment |
Remove style-loader
from your externals and make sure to generate actual css files from your css... otherwise webpack has to insert your styles somehow, right?
To do that use mini-css-extract-plugin
.
{
test: /.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
}
don't forget to add new MiniCssExtractPlugin()
to your plugins too. Preferable only for production build.
it seems build successfully, but when I try to import into another vue ap, it is geting error of[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?
– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
add a comment |
Remove style-loader
from your externals and make sure to generate actual css files from your css... otherwise webpack has to insert your styles somehow, right?
To do that use mini-css-extract-plugin
.
{
test: /.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
}
don't forget to add new MiniCssExtractPlugin()
to your plugins too. Preferable only for production build.
Remove style-loader
from your externals and make sure to generate actual css files from your css... otherwise webpack has to insert your styles somehow, right?
To do that use mini-css-extract-plugin
.
{
test: /.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader', // translates CSS into CommonJS
'sass-loader' // compiles Sass to CSS, using Node Sass by default
]
}
don't forget to add new MiniCssExtractPlugin()
to your plugins too. Preferable only for production build.
answered Nov 13 '18 at 14:47
PlayMa256PlayMa256
3,32811133
3,32811133
it seems build successfully, but when I try to import into another vue ap, it is geting error of[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?
– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
add a comment |
it seems build successfully, but when I try to import into another vue ap, it is geting error of[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?
– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
it seems build successfully, but when I try to import into another vue ap, it is geting error of
[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?– Ezeewei
Nov 13 '18 at 16:43
it seems build successfully, but when I try to import into another vue ap, it is geting error of
[Vue warn]: Unknown custom element: <mini-c> - did you register the component correctly? For recursive components, make sure to provide the "name" option. while I do have name defined as
MiniC` for the component. Any idea?– Ezeewei
Nov 13 '18 at 16:43
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
to try it, you have have to run github.com/adamchenwei/vue-dependency-demo
– Ezeewei
Nov 13 '18 at 16:44
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
I'm not a totally vue expert, i'm not able to help with that. But the key problem here is that in production webpack had to use style-loader to put your styles in your page, so that is why. Try looking for adding mini-css-extract-plugin with vue.
– PlayMa256
Nov 13 '18 at 17:11
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
hey np, yea that fix the main thing, the issue I had is dealling the strange component naming convention that Vuejs has... thanks a lot!
– Ezeewei
Nov 13 '18 at 17:12
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270649%2fwhy-webpack4-production-bundle-will-always-include-style-loader-css-loader-and%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
post your config.
– PlayMa256
Nov 13 '18 at 10:43
1
@PlayMa256 its in my repo, but I pasted anyway, here you go!
– Ezeewei
Nov 13 '18 at 14:40