fix: call to wp instead of r for css

The intention of using r was to fix problems with windows paths, but calling r will try to resolve path as well. This was breaking original webpack resolve mechanism from node_modules
This commit is contained in:
Pooya Parsa 2017-05-26 13:34:11 +04:30
parent 6e44648bfc
commit a1d78988c0
3 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@
<script> <script>
<% if (loading) { %>import NuxtLoading from '<%= (typeof loading === "string" ? loading : "./components/nuxt-loading.vue") %>'<% } %> <% if (loading) { %>import NuxtLoading from '<%= (typeof loading === "string" ? loading : "./components/nuxt-loading.vue") %>'<% } %>
<% css.forEach(function (c) { %> <% css.forEach(function (c) { %>
import '<%= r(c.src || c) %>' import '<%= wp(c.src || c) %>'
<% }) %> <% }) %>
let layouts = { let layouts = {

View File

@ -10,7 +10,7 @@ import PostCompilePlugin from 'post-compile-webpack-plugin'
import serialize from 'serialize-javascript' import serialize from 'serialize-javascript'
import { createBundleRenderer } from 'vue-server-renderer' import { createBundleRenderer } from 'vue-server-renderer'
import { join, resolve, basename, dirname } from 'path' import { join, resolve, basename, dirname } from 'path'
import { isUrl, r } from './utils' import { isUrl, r, wp } from './utils'
import clientWebpackConfig from './webpack/client.config.js' import clientWebpackConfig from './webpack/client.config.js'
import serverWebpackConfig from './webpack/server.config.js' import serverWebpackConfig from './webpack/server.config.js'
const debug = require('debug')('nuxt:build') const debug = require('debug')('nuxt:build')
@ -275,7 +275,8 @@ async function generateRoutesAndFiles () {
imports: { imports: {
serialize, serialize,
hash, hash,
r r,
wp
} }
}) })
const content = template(Object.assign({}, templateVars, { const content = template(Object.assign({}, templateVars, {

View File

@ -77,7 +77,7 @@ export function chainFn (base, fn) {
} }
} }
function wp (p) { export function wp (p) {
/* istanbul ignore if */ /* istanbul ignore if */
if (/^win/.test(process.platform)) { if (/^win/.test(process.platform)) {
p = p.replace(/\\/g, '\\\\') p = p.replace(/\\/g, '\\\\')