vue project include htaccess file in dist - vue.js

The project was initialised with vue init webpack. It doesn't have a public directory. I tried adding the .htaccess file at the same level as the index.html but it does not get included in the dist folder when I run npm run build

Related

empty site after using nmp run build (vue 2 cli)

Im using project vue 2 cli + vuex + router (without history mode) but when Im opening index.html, after "nmp run build" command, site is empty. How can I solve it... I need site to be opened on index.html (like common cdn project)
The dist directory is meant to be served by an HTTP server (unless you've configured publicPath to be a relative value), so it will not work if you open dist/index.html directly over file:// protocol.
Source
One way to test your build, is to install Serve:
// install Serve globally
npm install -g serve
// Run in project root, with folder name as input
serve -s dist

npm pack doesn't include all files in the package

I run npm pack inside dist folder, but it doesn't include all it's files.
it just contains: package.json, ReADME.md, index.js (main).
there is no .gitignore file, and I tried to create an empty .npmignore file, but it didn't help.
I also tried to add files array to package.json.
all files in the root or subfolders (js or other files) don't included in the pack file.
I found another files property in my package.json, so adding another one has no effect, also .gitignore and .npmignore have no effect.

Using Node Modules in Simple Project

I have a very simple web project and I'm using npm init to create the package.json file for the project. My project structure is below:
ProjectFolder
--app /this is the folder for js files
--css
--scss
--lib /this is for files like jQuery
--index.html
When adding a node package, it will create a node_modules folder like this:
ProjectFolder
--node_modules
--app /this is the folder for js files
--css
--scss
--lib /this is for files like jQuery
--index.html
Let's say I add jquery through npm install and make it a dependency. Is it good practice to link to the jquery file in node_modules from my index.html or move the jquery file to my lib folder?
Is there a way to move the jquery file to my lib folder when installing?
I don't want to move the node_modules folder to the server and want to know the best practice.
Your package.json is essentially your link. It contains a list of the packages you are dependent on and their versions. If you install something using npm install it has to be a published npm package on an npm repository somewhere (either public or private). It downloads a zipped version of the npm package and unzips it into node_modules. Anything in there is automatically then available to your app. Hope that helps.

How to config npm to search exported modules?

I use npm in my client side development.
I use ES6 and I import modules to mapApp.js file from library that I installed in node_modules folder with help of npm tool.
Here is how I import module to mapApp.js file:
import GML from 'ol/format/GML';
Where is 'ol/format/GML' is relative path to node_modules folder.
At some point I create my own module(in config.js file) outside of node_modules folder and I need to import it to mapApp.js file.
Here is picture of project archeticture:
My question is how can I config npm to make search for imports not only in node_modules folder but,
also in specific folder outside of node_modules?

What is the best practice for keeping tsconfig.json in a subdirectory of the project root?

I have a project with /src directory at the project root and I want to keep all my configuration files (tsconfig.json included) in a /config directory. The problem is when I call tsc from the root directory passing the --project flag tsc only looks under the /config directory for .ts files. I've tried --rootDir flag in addition to --project but --rootDir seems to be overridden. I've tried including rootDir in the tsconfig.json file but that doesn't work either. Is there an attribute in tsconfig.json that will let me specify where to look for sources other than listing each file to include in the files section?