-
-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Labels
Description
Hello Guys,
i'm setting up a vue ssr with vuetify and webpack from scratch and i'm having trouble when i added vuetify-loader to my webpack configuration. Here is the error:
Although the error is related to vue-loader, everything worked fine until i added vuetify-loader, Thats why i`m suspecting that something is wrong with my vuetify-loader configuration.
Here are my webpack files (base config is merged to both client and server config to generate the respectives bundles)
webpack-base-config:
const base = {
mode: is.production ? 'production' : 'development',
devtool: is.production ? 'source-map' : 'inline-source-map',
devServer: {
contentBase: distPath,
clientLogLevel: 'trace',
host: '0.0.0.0',
hot: true
},
resolve: {
extensions: ['.ts', '.js', '.vue'],
alias: {
'@': posix.resolve('src')
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
include: [srcPath]
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource'
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource'
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
},
exclude: /node_modules/
},
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
plugins: [
new VueLoaderPlugin(),
new VuetifyLoaderPlugin({
registerStylesSSR: true
})
]
}
webpack-server-config:
const server = merge(base, {
entry: {
app: join(srcPath, 'server-entry.js')
},
target: 'node',
externalsPresets: { node: true },
externals: [nodeExternals({
allowlist: /\.css/
})],
output: {
libraryTarget: 'commonjs2'
},
plugins: [
new VueSSRServerPlugin()
]
})
webpack-cllient-config:
const client = merge(base, {
entry: {
app: join(srcPath, 'client-entry.js')
},
output: {
filename: '[name].bundle.js',
path: distPath,
clean: true,
publicPath: '/'
},
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.s(c|a)ss$/,
use: [
{
loader: 'vue-style-loader',
options:
{ manualInject: true }
},
'css-loader',
{
loader: 'sass-loader',
// Requires >= sass-loader@^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
indentedSyntax: true // optional
}
}
}
]
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new VueSSRClientPlugin()
]
})
package-json:
{
"name": "vue-webpack",
"version": "0.0.1",
"description": "Vue Webpack",
"main": "server.ts",
"scripts": {
"dev": "ts-node -r dotenv/config ./server.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@types/express": "^4.17.12",
"@types/webpack-dev-middleware": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"babel-loader": "^8.2.2",
"css-loader": "^5.2.6",
"deepmerge": "^4.2.2",
"eslint": "^7.29.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.12.1",
"memory-fs": "^0.5.0",
"sass": "~1.32",
"sass-loader": "^12.1.0",
"style-loader": "^3.0.0",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"typescript": "^4.3.4",
"vue-loader": "^15.9.7",
"vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.6.14",
"vuetify-loader": "^1.7.1",
"webpack": "^5.41.1",
"webpack-dev-middleware": "^5.0.0",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"axios": "^0.21.1",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"vue": "^2.6.14",
"vue-meta": "^2.4.0",
"vue-router": "^3.5.2",
"vue-server-renderer": "^2.6.14",
"vuetify": "^2.5.6",
"vuex": "^3.6.2"
}
}
Is it possible that vuetify loader is conflicting with vue loader or i'm missing something?
Thanks in advance
