반응형
npm을 실행하는 경우 빌드 실행 시 VUE에서 build.js 파일만 생성
npm 빌드를 실행하면 dist 디렉토리에 build.js만 생성되며 이것은 내 패키지다.json 및 내 웹 팩 구성.웹 팩의 구성 또는 패키지 구성에 문제가 있는지 여부 알 수 없는 경우
꾸러미json
{
"name": "humanspiral-front",
"description": "Human Spiral Image Generator Front End",
"version": "1.0.0",
"author": "Isaac Laurrabaquio <marcodeleonmx@gmail.com>",
"license": "MIT",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules --mode production"
},
"dependencies": {
"axios": "^0.19.0",
"vue": "^2.5.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"copy-webpack-plugin": "^4.0.3",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"uglifyjs-webpack-plugin": "^2.1.3",
"vue-loader": "^14.2.2",
"vue-template-compiler": "^2.4.4",
"webpack": "^4",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3"
}
}
웹 팩 구성 파일.
var path = require('path')
var webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'production',
entry: path.resolve(__dirname,'./src/main.js'),
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './static',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
module.exports.optimization = {
minimizer: [new TerserPlugin()],
minimize: true
}
}
서버에 배포할 모든 파일을 생성해야 하지만 빌드.js만 생성해야 함
반응형
'programing' 카테고리의 다른 글
uint64_t 인쇄 방법?오류: "허위 후행 '%' 형식" (0) | 2022.05.23 |
---|---|
C99에서 유니온을 통한 형식연결이 불특정화 되어 있으며, C11에 명시되어 있는가? (0) | 2022.05.23 |
다중 요소 선택 Vue.js (0) | 2022.05.23 |
부울 체크에 xor 연산자를 사용하는 것이 좋은 관행인가? (0) | 2022.05.23 |
JNI 공유 라이브러리(JDK) 로드 실패 (0) | 2022.05.23 |