我正在努力让源代码使用css-loader.
控制台输出:
来自css-loader的文档说:
SourceMaps
要包含SourceMaps,请设置sourceMap查询参数.
要求( "CSS-装载机?sourceMap!./ file.css")
我的webpack.config
var webpack = require('webpack')
module.exports = {
entry: './src/client/js/App.js',
output: {
path: './public',
filename: 'bundle.js',
publicPath: '/'
},
plugins: process.env.NODE_ENV === 'production' ? [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin()
] : [],
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' },
{ test: /\.scss$/, loaders: ['style', 'css', 'sass']},
{ test: /\.css$/, loader: "style-loader!css-loader?sourceMap!./file.css" },
{ test: /\.png$/, loader: "url-loader?limit=100000" },
{ test: /\.jpg$/, loader: "file-loader" }
] …
Run Code Online (Sandbox Code Playgroud) 我试图通过WinSCP SSH到我的服务器,虽然问题也会发生在putty上.
我有Ubuntu 12.04我编辑/etc/ssh/sshd_config
并添加PermitRootLogin without-password
到文件的底部.但这似乎仍然没有改变我的问题.
人们提到需要重启ssh恶魔.我试过了:
/etc/init.d/sshd reload
reload sshd.service
/etc/init.d/sshd reload
Run Code Online (Sandbox Code Playgroud)
以上所有都是未被承认的.
那时我也试过Files ¬ Custom Commands ¬ sudo -s & su
没有运气.
情况
我有一个返回的JSON对象.以下是一个例子.在who
这个特定的例子可以改变任何属性名称要求.所以例如下次这将是name
而不是who
[{"who":"Arthur"},{"who":"Craig"},{"who":"Dan"},{"who":"Daniel"},{"who":"Frank"},{"who":"Ian"},{"who":"jamie"},{"who":"Jason"},{"who":"jaz"},{"who":"Liam"},{"who":"Paul"},{"who":"Shaun"},{"who":"Wayne"}]
Run Code Online (Sandbox Code Playgroud)
问题
在我的JS中,我需要能够引用属性并访问其数据而不使用其名称,因为名称将始终不同.
我试过了什么
data.forEach(function(m){
console.info(m); // Object { who="Craig"}
console.info(m.who); // Craig, as expected
console.info(m[0]); // now not sure who to get it if who changes to name
});
Run Code Online (Sandbox Code Playgroud) 我想webpack检测新创建的文件的新更改.
我的完整webpack.config.js
档案
module.exports = {
entry: './src/client/js/index.js',
output: {
path: 'public',
filename: 'bundle.js',
publicPath: '/'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: process.env.NODE_ENV === 'production' ? [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin()
] : [],
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?presets[]=es2015&presets[]=react' },
{ test: /\.scss$/, loaders: ['style', 'css', 'sass']}
]
},
}
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索和搜索,但找不到任何会自动添加新文件到我的观察者.
我有以下代码:
if (typeof console === "object" && typeof console.error === "function") {
function e(msg) {"use strict"; console.info(msg);}
}
Run Code Online (Sandbox Code Playgroud)
jsLint为其提供以下错误:
函数语句不应放在块中.使用函数表达式或将语句移动到外部函数的顶部.
为什么会出现此错误,这是什么意思?
我能够在页面中看到我的样式表而没有任何问题.但是,我不能让我的webfonts工作.我试图保存我的CSS的输出,这是不会发生的.我相信这就是字体不起作用的原因.
的WebPack
var webpack = require ('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
resolve: {
extensions: ['', '.js']
},
entry: ['webpack-hot-middleware/client','./src/client/js/Kindred.js'],
output: {
path: './public',
filename: 'bundle.js',
publicPath: '/public/js'
},
devtool: 'cheap-module-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {presets: ['es2015', 'react', 'react-hmre', 'stage-0']}
},
{test: /\.scss$/, loaders: [
'style?sourceMap&modules',
'css?sourceMap&modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
'resolve-url',
'sass?sourceMap&modules']},
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader?modules!css-loader?sourceMap&modules" )},
{test: /\.png$/, loader: "url-loader?limit=100000"},
{test: /\.jpg$/, loader: "file-loader"},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file?name=public/font/[name].[ext]'
}
] …
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过TS 中可用的可选链接提供的安全性访问动态属性。然而,这似乎是无效的。
export const theme = {
headers: {
h1: {
},
h6: {
color: '#828286'
},
},
}
console.info(theme?.headers?.['h6']?.color ?? '#000') //will pass
console.info(theme?.headers?.['h1']?.color ?? '#000') //will fail
Run Code Online (Sandbox Code Playgroud)
Identifier expected. TS1003
10 | const StyledTypography = styled.div`
11 | margin: 0;
> 12 | color: #000; ${({theme}) => theme?.headers?.[variant]?.color ?? '#000'}
| ^
13 | `
14 | return (
15 | <StyledTypography as={variant}>
Run Code Online (Sandbox Code Playgroud)
似乎可选更改将应用于[]
作为类型的可选,但不适用于内部的值。
我怎样才能使这个成为可选而不必做[undefined || someDefaultValue]
?
我没有任何问题进行热重新加载,但每当我进行单个css更改时它会重新加载整个页面.我希望它能够注入任何css更改,并且理想情况下与react组件类似,除非真正需要完全重新加载.
**我得到以下控制台日志**
[WDS] App updated. Recompiling...
client?cd17:41 [WDS] App updated. Recompiling...
client?8505:41 [WDS] App updated. Recompiling...
client?cd17:41 [WDS] App updated. Recompiling...
client?8505:41 [WDS] App hot update...
dev-server.js:45 [HMR] Checking for updates on the server...
client?cd17:41 [WDS] App hot update...
dev-server.js:33 [HMR] Cannot apply update. Need to do a full reload!
(anonymous) @ dev-server.js:33
dev-server.js:34 [HMR] Error: Aborted because ./node_modules/css-loader/index.js?{"modules":true,"sourceMap":true,"importLoaders":2,"localIdentName":"[path]___[name]__[local]___[hash:base64:5]"}!./node_modules/postcss-loader/index.js?sourceMap&parser=postcss-scss!./src/components/shared/userPages/userPages.css is not accepted
Update propagation: ./node_modules/css-loader/index.js?{"modules":true,"sourceMap":true,"importLoaders":2,"localIdentName":"[path]___[name]__[local]___[hash:base64:5]"}!./node_modules/postcss-loader/index.js?sourceMap&parser=postcss-scss!./src/components/shared/userPages/userPages.css -> ./src/components/shared/userPages/userPages.css -> ./src/components/Signin/index.js -> ./src/routes.js -> ./src/index.js -> 0
at …
Run Code Online (Sandbox Code Playgroud) javascript reactjs webpack webpack-dev-server react-hot-loader
我正在考虑使用jQuery.browser做一些事情,但这只会返回你所在的浏览器以及它是否是webkit等.
所以我基本上想要在移动设备上关闭某些js文件甚至加载?
我想你可以做到但是怎么做?
我正在尝试require
使用传递给函数的变量的browserify文件:
var playersOptions = {
name: 'players',
ajax: 'team-overview',
route: {
name: 'overview',
path: 'playersOverview',
url: 'playersoverview'
}
};
var BackboneView = require(playersOptions.route.path);
//Error: Uncaught Error: Cannot find module 'playersOverview'
var BackboneView = require('playersOverview');
//Requires the file without any problems.
Run Code Online (Sandbox Code Playgroud)
我很困惑为什么会失败?当它们都是字符串时怎么能找不到模块?
javascript ×8
webpack ×4
css ×2
node.js ×2
sass ×2
browserify ×1
css-loader ×1
fonts ×1
jquery ×1
jshint ×1
jslint ×1
mobile ×1
object ×1
properties ×1
reactjs ×1
root ×1
ssh ×1
typescript ×1
ubuntu ×1