vue packaged stepped pit project in mind

Packaging commands based vue projects under webpack + vue-cli is  npm RUN Build  , after waiting for the completion of packaging generated dist folder in the root directory, which contains all relevant content items.

Note: You need the full version of vue-cli project, initiated by vue init webpack project can not pack files vue init webpack-simple initialization of the project, can not be packaged. Directory structure is as follows


vue init directory structure webpack initialized, packaging and rely build config folder configuration, static storage static files

vue init directory structure webpack-simple initialization of the lack of build, config, static folder, generally used for Novice

 

Encountered a few problems during packaging, packaging is also hoping to give some help novice students.

1, can pack a local test result is complete, simply double-click to open or right-editing tools in the browser to open the folder. 

 

2, after opening a blank site, because it is local, the path does not need to be configured prior to packaging

config / index.js, there dev and build two parameters, the value in the build parameters assetsPublicPath and  '/'  modify  './'  . Repackaged, and then refresh the page.

 

 3, after opening the project if css background images or icons website does not load up, you need to configure a reference path

build / utils.js in, ctrl + f search  ExtractTextPlugin.extract  .

 4, if a third three operations, and refers to the directory and file static static src directory at the same level by the relative path, this time the package will not find the file static directory, you need to modify the relative path references absolute path.

such as: 

Before modifying a  ../../static/ueditor   , modified  @ / .. / static / ueditor  .

 

Guess you like

Origin www.cnblogs.com/Simple-and-complex/p/11573738.html