This is an example to my article “How webpack’s ContextReplacementPlugin works”
You have the moment.js library, and you have a dynamic import:
require('./locale/' + name + '.js')| var faker = require('faker') | |
| var fs = require('fs') | |
| var path = require('path') | |
| for (var i = 0; i < 1000; i++) { | |
| generateMD() | |
| } | |
| function generateMD () { | |
| var fileName = faker.lorem.word() + '-' + faker.lorem.word() |
| // check version | |
| node -v || node --version | |
| // list installed versions of node (via nvm) | |
| nvm ls | |
| // install specific version of node | |
| nvm install 6.9.2 | |
| // set default version of node |
| const MY_DOMAIN = "agodrich.com" | |
| const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2" | |
| const DISQUS_SHORTNAME = "agodrich" | |
| addEventListener('fetch', event => { | |
| event.respondWith(fetchAndApply(event.request)) | |
| }) | |
| const corsHeaders = { | |
| "Access-Control-Allow-Origin": "*", |
| //First commit any outstanding code changes, and then, run this command: | |
| git rm -r --cached . | |
| //This removes any changed files from the index(staging area), then just run: | |
| git add . | |
| //Commit | |
| git commit -m "Atualizando .gitignore para..." |
| import camelCase from 'lodash/camelCase'; | |
| import { prisma } from '@cpath/universal/shared/db'; | |
| import knexClient from './knex'; | |
| // Contents of the knexClient import above | |
| // import Knex from 'knex'; | |
| // const knexClient: Knex = Knex({ | |
| // client: 'pg', | |
| // connection: { | |
| // user: process.env.POSTGRES_USER, | |
| // password: process.env.POSTGRES_PASSWORD, |
| 'use strict' | |
| const cloudinary = require('cloudinary') | |
| const Promise = require('bluebird') | |
| const co = require('co') | |
| const fs = Promise.promisifyAll(require('fs')) | |
| const request = require('request') | |
| const moment = require('moment') | |
| // FILL THIS | |
| cloudinary.config({ | |
| cloud_name: '', |
| /* Polyfill indexOf. */ | |
| var indexOf; | |
| if (typeof Array.prototype.indexOf === 'function') { | |
| indexOf = function (haystack, needle) { | |
| return haystack.indexOf(needle); | |
| }; | |
| } else { | |
| indexOf = function (haystack, needle) { | |
| var i = 0, length = haystack.length, idx = -1, found = false; |
This is an example to my article “How webpack’s ContextReplacementPlugin works”
You have the moment.js library, and you have a dynamic import:
require('./locale/' + name + '.js')When you add something into a .gitignore file, try this:
git add [uncommitted changes you want to keep] && git commit
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
If you remove something from a .gitignore file, and the above steps don't work, try this:
| // First list files that match to be sure | |
| find . -name "*.spec.js" -type f | |
| then | |
| find . -name "*.spec.js" -type f -delete |